Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is this not working?

I am trying to make a script that will spawn an object randomly throughout a map , the script isn't spawning the object at all , and there is no syntax errors

H=game.Lighting:FindFirstChild("SpawnScript").Parent.Instanceclone()

if 5>1  then do
	game.Lighting:FindFirstChild("FireDragonSlayerBall").Parent.Instanceclone(1)
	H.Properties.Position = 2307.104, 148.5, -73.582 		
	wait(3)

end	
end
print ("5>1") 

2 comments

1

" there is no syntax errors" I see three errors right off the bat. Instanceclone() is not even a valid function of an object, even if it was then it would be called with a ":" not a ".". Second, do is not necessary, and is quite redundant when you have the "then" statement in there. It's not even part of an if then statement. Also, there is not arguments required for the Clone function.

0

Please review the wiki, and check out some sources to find out how to script in RBX.Lua.

2 answers

Try this:

if 5>1 then
    game.Lighting["FireDragonSlayerBall"].Parent.Instance:clone()
    H.Properties.Position = Vector3.new(2307.104, 148.5, -73.582)        
    wait(3)
	end 
end
print ("5>1")

H is also undefined, so I am not sure if you have that set already.

When cloning something, you just use Object:clone() If you are instancing something, just do local variable = Instance.new("Object") then do whatever you want with it.

This code looks incomplete so I tried my best to answer.

EDIT: You also don't put a do statement after then, that is only used in certain loops.

EDIT2: You also need to put a Vector3 function around the position, so that the game knows where to put the object. You also need to do something when cloning the object. You need to set a variable, then decide what to do with that variable.

Okay, first of all. Why do you even check if 5 is greater than 1? There is no need for even checking, because it will always be.

Your code:

if 5>1  then do
    game.Lighting:FindFirstChild("FireDragonSlayerBall").Parent.Instanceclone(1)
    H.Properties.Position = 2307.104, 148.5, -73.582        
    wait(3)

end 
end
print ("5>1") 

Should be:

if 5>1  then
    local H = game.Lighting:FindFirstChild("FireDragonSlayerBall"):clone()
    H.Position = Vector3.new(2307.104, 148.5, -73.582)
    wait(3)
end
print ("5>1") 

This discussion is preserved as it was. New answers, comments, and votes are closed.