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")
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")