This script is supposed to teleport the player, anchor their torso, give them a weapon and equip it for them, and then unanchor the torso.
However, the script doesn't teleport you; it does everything but that.
I have no idea why this script isn't working properly, and output gave me nothing.
Can someone please help me?
Here's the script:
local Player = script.Parent.Parent.Parent.Parent.Parent
local Primary = game.ReplicatedStorage.Guns.AK47:Clone()
function onButtonClicked()
if game.Workspace.Playing.Value == true then
Player.CameraMode = "LockFirstPerson"
Player.Backpack.Teled.Value = true
local torso = Player.Character.Torso
spawns = {}
for i,v in ipairs(game.Workspace.Map.SSpawns:GetChildren()) do
if v.Name == "SSpawn" then
table.insert(spawns,v)
end
end
torso.CFrame = spawns[math.random(1,#spawns)].CFrame
+ Vector3.new(0,4,0)
wait(0.1)
torso.Anchored = true
wait(0.1)
Primary.Parent = Player.Backpack
Player.Character.Humanoid:EquipTool(Player:WaitForChild("Backpack"):WaitForChild(Primary.Name))
wait(0.1)
torso.Anchored = false
script.Parent.Parent.Parent:remove()
end
end
script.Parent.MouseButton1Click:connect(onButtonClicked)

4 comments
Notice the ','
Thanks!
Wait, I still have the same issue in online mode. It won't teleport the player.
Press F9. It should come up with the dev console, and you can see the error.