Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I was trying to make a respawn teleport for my game, but it didn't work. Any suggestions?

Asked by 3 years ago
local hum = script.Parent:WaitForChild("Humanoid")
hum.Died:Connect(function()
    wait(game.Players.RespawnTime + 0.3)
    local humroot = script.Parent:WaitForChild("HumanoidRootPart")
    local spawns = game.Workspace.Spawns:GetChildren()
    humroot.CFrame = CFrame.new(spawns[math.random(1, #spawns)].Position + Vector3.new(0, 10, 0))
end)

Answer this question