generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: whats wrong with this?

Previous Thread :: Next Thread 
DarkScreeching is not online. DarkScreeching
Joined: 24 Apr 2011
Total Posts: 233
26 Jul 2015 08:07 PM
function onTouch(part)
local Lava = game.Workspace["Lava Brick"]
Lava.destroy()
end
end

Lava.Touched:connect(onTouch)
Report Abuse
TrainingToTroll is not online. TrainingToTroll
Joined: 27 Oct 2012
Total Posts: 1757
26 Jul 2015 08:07 PM
Lava:Destroy()
caps probably
Report Abuse
Sharpy033 is not online. Sharpy033
Joined: 02 Jul 2008
Total Posts: 3851
26 Jul 2015 08:08 PM
something
Report Abuse
TrainingToTroll is not online. TrainingToTroll
Joined: 27 Oct 2012
Total Posts: 1757
26 Jul 2015 08:08 PM
also check if Lava is nil in an if statement just to be sure it won't error
Report Abuse
baldo46 is not online. baldo46
Joined: 28 Jul 2008
Total Posts: 1254
26 Jul 2015 08:09 PM
It should say part:Destroy(), not lava:Destroy()
Report Abuse
TrainingToTroll is not online. TrainingToTroll
Joined: 27 Oct 2012
Total Posts: 1757
26 Jul 2015 08:10 PM
OH yea. What he said.
Report Abuse
DarkScreeching is not online. DarkScreeching
Joined: 24 Apr 2011
Total Posts: 233
26 Jul 2015 08:14 PM
function onTouch(part)
local Lava = game.Workspace["Lava Brick"]
if (Lava ~= nil) then
part.Destroy()
end
end

Lava.Touched:connect(onTouch)

hows this?
Report Abuse
pieshop97 is not online. pieshop97
Joined: 11 Mar 2011
Total Posts: 550
26 Jul 2015 08:14 PM
@Baldo he could've named the part Lava, then it would be a matter of whether or not the L is capitalized.


Abraham Lincoln's most famous quote: "You know everything on the internet is true."
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
26 Jul 2015 08:15 PM
function onTouch(part)
local Lava = game.Workspace["Lava Brick"]
if (part ~= nil) then
part:Destroy()
end
end

Lava.Touched:connect(onTouch)

that would destroy any part that touches lava
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
26 Jul 2015 08:16 PM
local Lava = workspace:WaitForChild("Lava")

function onTouch(part)
if (part ~= nil) then
part:Destroy()
end
end

Lava.Touched:connect(onTouch)

don't worry im not that stupid
Report Abuse
DarkScreeching is not online. DarkScreeching
Joined: 24 Apr 2011
Total Posts: 233
26 Jul 2015 08:17 PM
im trying to destroy the lava
(sorry first time scripting)
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
26 Jul 2015 08:19 PM
You indexed 'destroy' as a member of 'Lava'. This is fine, but you always have to reference self if you're doing it that way.

function onTouch(part)
local Lava = game.Workspace["Lava Brick"]
Lava.destroy(Lava);
end
end

Lava.Touched:connect(onTouch)


Alternatively, just call it as a method.

function onTouch(part)
local Lava = game.Workspace["Lava Brick"]
Lava:destroy()
end
end

Lava.Touched:connect(onTouch)


And nao, I wanted to goulify your code.

local Lava = workspace:FindFirstChild('Lava Brick');

Lava.Touched:connect(function()
if Lava then
Lava:Destroy();
end
end)
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
26 Jul 2015 08:20 PM
ohhhh
why would you want to destroy the lava?
i had the assumption that you wanted to destroy any part that touches it, considering it is laval

local lava = workspace:WaitForChild("Lava")

function onTouch(part)
if part ~= nil then
lava:Destroy()
end
end

lava.Touched:connect(onTouch)

also for checking if something is not equal to nil or false, do this

if (condition) then
-- code

so for example,

if part then
-- code
end
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
26 Jul 2015 08:20 PM
Cannot destroy something by calling "part.destroy()"

Since the 'Destroy' is a function (has the'()' at the end) then it needs to be caled by using':' so it would be:

part:Destroy()
Report Abuse
DarkScreeching is not online. DarkScreeching
Joined: 24 Apr 2011
Total Posts: 233
26 Jul 2015 08:36 PM
im still having trouble, now once i run in studio the brick is gone without touching the brick which i want it to touch. i have a conveyor belt that is carrying unanchored pieces of lava and i want them to disappear once it reaches the end of the belt
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
26 Jul 2015 08:39 PM
Have this in a script at the end of the belt:


script.Parent.Touched:connect(function(lava)
if lava.Name == 'Lava Brick' then--or whatever the lava is called
lava:Destroy()
end
end)
Report Abuse
DarkScreeching is not online. DarkScreeching
Joined: 24 Apr 2011
Total Posts: 233
26 Jul 2015 08:47 PM
thanks so much man:)
just my last question, i want a lava spawner on the other side spitting out lava so there is a continious flow, can u help me out?
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
26 Jul 2015 08:48 PM
local lava = game.Lighting.LAVA

while wait(number)do
lava.CFrame = PartOfWhichLavaComesOutOf.CFrame
lava.Anchored = false
end

--Assuming 'lava' is a part and not a model
Report Abuse
DarkScreeching is not online. DarkScreeching
Joined: 24 Apr 2011
Total Posts: 233
26 Jul 2015 09:02 PM
so do i just put Lava in lighting and and that script will spawn Lava pieces for me? and i also want to spawn 4-5 different Lava pieces
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
26 Jul 2015 09:05 PM
--i forgot something O.o

local lava = game.Lighting.LAVA

while wait(number)do
local lavey = lava:Clone()
lavey.CFrame = PartOfWhichLavaComesOutOf.CFrame
lavey.Anchored = false
end
Report Abuse
DarkScreeching is not online. DarkScreeching
Joined: 24 Apr 2011
Total Posts: 233
26 Jul 2015 09:11 PM
okay so i put a number in time and where is says partofwhichlavacomesoutof what do i put? i know how to spawn multiple lava pieces just repeat the script and rename the lava pieces in lighting and the script
Report Abuse
Burglered is not online. Burglered
Joined: 14 Jul 2011
Total Posts: 962
26 Jul 2015 09:12 PM
NoooOOOOOooOOoooooOOO Never putstuff in lighting. Use ReplicatedStorage or ServerStorage. They're made for a reason.

EnergyDrink.dll is missing or has been corrupted.
Report Abuse
Burglered is not online. Burglered
Joined: 14 Jul 2011
Total Posts: 962
26 Jul 2015 09:15 PM
local lava = game.Lighting.LAVA

while wait(2) do
local lavey = lava:Clone()
lavey.CFrame = ['Dispenser'].CFrame
lavey.Anchored = false
end


EnergyDrink.dll is missing or has been corrupted.
Report Abuse
DarkScreeching is not online. DarkScreeching
Joined: 24 Apr 2011
Total Posts: 233
26 Jul 2015 09:25 PM
so what do i have to do after placing this script in the spawner?
Report Abuse
Burglered is not online. Burglered
Joined: 14 Jul 2011
Total Posts: 962
26 Jul 2015 09:28 PM
Put this inside the collector. This is easier.

script.Parent.Touched:connect(function(lava)
if (lava.Name == 'Lava Brick') then
lava.Position = Dispenser.Position --or use CFrame
else
print('Not lava.')
end
end)


(OPTIONAL) Dropper Script:
while true do
wait(1)
local lavaa = game.ReplicatedStorage:FindFirstChild('Lava Brick')
local lavaClone = lavaa:Clone()
lavaClone.Parent = workspace
local cash = Instance.new('IntValue')
cash.Parent = lavaClone
cash.Value = 1
lavaClone.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1,0)
end


EnergyDrink.dll is missing or has been corrupted.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image