01 | local plr = game.Players.LocalPlayer |
02 | local char = plr.CharacterAdded;wait() |
03 | local humanoid = char:FindFirstChild( "Humanoid" ) |
04 | humanoid.Health = 0 |
05 | humanoid.Died:connect( function () |
06 | wait( 4 ) |
07 | if plr.leaderstats.Stage.Value = = 1 then |
08 | char.Torso.CFrame = CFrame.new(workspace.Spawns.Stage 1 Spawn.Position) + Vector 3. new( 0 , 2 , 0 ) |
09 | end |
10 | end ) |
00:18:53.756 - ServerScriptService.StageSpawning:2: attempt to index local 'plr' (a nil value)
also, stop removing my questions i just want this script fixed then i will stop
Okay, so, if this isn't in a local script, it won't work. if it isn't in a local script, I advise you put it in one.
You should use break joints instead of changing the health
01 | local plr = game.Players.LocalPlayer |
02 | local char = plr.CharacterAdded;wait() |
03 | local humanoid = char:FindFirstChild( "Humanoid" ) |
04 | plr:BreakJoints() |
05 | humanoid.Died:Connect( function () |
06 | wait( 4 ) |
07 | if plr.leaderstats.Stage.Value = = 1 then |
08 | char.Torso.CFrame = CFrame.new(game.Workspace.Spawns.Stage 1 Spawn.Position) + Vector 3. new( 0 , 2 , 0 ) |
09 | end |
10 | end ) |
You should just use the exact coordinates of the spawn if the game.Workspace section doesnt work. Also, use :Connect instead of :connect and game.Workspace rather than .workspace.