So im trying to make a game like the normal elevator but i cant get my script to work
local floor = math.random(1,2) local maps = game.ServerStorage.FLOORS while true do if floor == 1 then maps.shronk:Clone(workspace) wait(30) game.Workspace.shronk:Destroy() elseif floor == 2 then maps.tightrope:Clone(workspace) wait(30) game.Workspace.tightrope:Destroy() end end
I dont understand why it wont work
You aren't actually parenting the cloned object to anywhere so you must do this. You must also define a variable to tell the game what you want parented.
math.randomseed(tick()) local maps = game.ServerStorage.FLOORS while true do local floor = math.random(1,2) if floor == 1 then ok = maps.shronk:Clone() ok.Parent = game.Workspace wait(30) game.Workspace.shronk:Destroy() elseif floor == 2 then ok = maps.tightrope:Clone() ok.Parent = game.Workspace wait(30) game.Workspace.tightrope:Destroy() end end
I hope this helps, and good luck on your game!