Hello, i've recently been trying to get into scripting and as i am new to it, i don't understand most things. I've been trying to make a script that teleports you to a **XYZ ** position and sets your walkspeed to 0 when you die. I really don't understand what i did wrong i've searched the internet but the best thing i can do is just ask here.
game:GetService('Players').PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
Humanoid.Walkspeed = 0
end)
end)
end)
function Teleport()
x = target.-23.56
y = target.0.5
z = target.-0.615
game.Players.LocalPlayer.Character:MoveTo(Vector3.new(-23.56,0.5,0.615))
end)
end)
end)
if Humanoid.Walkspeed = 0 then Teleport()
I know i've messed up a lot of things in this, but i am looking for help. Thank you for your attention.

1 comment
what do you mean by "teleport when dead"? like when they die you want them to teleport to a position and then they respawn