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)
You cannot add a value to another value without defining which argument inside the value you're changing. Although, some things don't require you to define, it just automatically assumes what argument to use (normally just the first argument), like this:
torso.CFrame = spawns[math.random(1,#spawns)].Position + Vector3.new(0,4,0)
If you wanted to change more than just the position:
torso.CFrame = CFrame.new(spawns[math.random(1,#spawns)].Position, Vector3.new(0,0,0))
There is an event called ":MoveTo" you could use that.