I was testing this script and on the Output is saying there's a missing argument, here's what it says:
23:07:05.802 - Argument 1 missing or nil 23:07:05.803 - Script 'Players.Player1.PlayerGui.ScreenGui.TextButton.LocalScript', Line 9 - global Down 23:07:05.803 - Script 'Players.Player1.PlayerGui.ScreenGui.TextButton.LocalScript', Line 26
Here's the script:
plr = game.Players.LocalPlayer a = plr.Up.Value function Down() for i,v in pairs(game.Workspace:GetChildren()) do if v.Name == "SpawnLocation" then vv = {v.Name} d = vv[math.random(1,#vv)] plr.Character.Humanoid:MoveTo(d.Position) a = false end end end function Up() for i,v in pairs(game.Workspace.Lobby:GetChildren()) do if v.Name == "SpawnLocationU" then vv = {v.Name} d = vv[math.random(1,#vv)] plr.Character.Humanoid:MoveTo(d.Position) end end end script.Parent.MouseButton1Down:connect(function() if a == true then Down() elseif a == false then Up() end end)
You could try this:
replace the for loops with this
ch = game.Workspace:GetChildren() for i = 1, #ch do if ch[i].Name == "SpawnLocation" then d = ch[(math.random(1,#ch))] plr.Character.Humanoid:MoveTo(d.Position) a = false end end
If it gives you any errors then please post them.