I recently started scripting last week and I created this script with some help of my friend and when I tested it out, it wasn't working and it didn't show any errors so I do not know what to fix inside of my script. I am scripting an obby and I scripted it so that if the player's leaderboard "Stage" stat's value is 1, it would teleport the character to stage one's checkpoint. The problem is that the character isn't being teleported. My code is shown below. Help is much appreciated and thank you in advanced.
local part = script.Parent part.Touched:Connect(function(hit) if hit.Parent:FindFirstChild('Humanoid') then local plr = game.Players:GetPlayerFromCharacter(hit.Parent) plr.leaderstats.Stage.Value = 1 end end) game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(char) if plr.leaderstats.Stage.Value == 1 then char.Torso.CFrame = game.Workspace.Checkpoint1.CFrame + Vector3.new(0, 10, 0) end end) end)