plr = game.Players.LocalPlayer
char = plr.Character
char:WaitForChild("Humanoid").Died:Connect(function()
print("Death")
local char = (plr.Character) or (plr.CharacterAdded:Wait()) -- // set the new character model
if (char and char.Parent) then
print(char.Name .. " exists!")
local stage = plr.leaderstats.Stage.Value
print ("Stage value found")
if stage == 0 then
print("Stage is 0")
char:SetPrimaryPartCFrame(workspace.StageSpawns.Stage0.CFrame)
print("TELEPORTED")
end
end
end)
See my code prints all the statements and says TELEPORTED in output but doesn't teleport me to Stage0 CFrame.
The script is a local script in player gui.
I made a script in ServerScriptService so the script doesn't reset
game:GetService("StarterGui").ResetPlayerGuiOnSpawn = false

1 comment
Nevermind it works