So I made a script Called "DeathHandler" In ServerScriptService and this is the code.
01 | game.Players.PlayerAdded:Connect( function (player) |
02 | print ( "Player Added Yay!" ) |
03 | local Stage = player:WaitForChild( "leaderstats" ):WaitForChild( "Stage" ) |
04 | player.CharacterAdded:Connect( function (character) |
05 | print ( "Character Added!" ) |
06 | local StagePart = game.Workspace:FindFirstChild(Stage.Value) |
07 | print (StagePart) |
08 | character.HumanoidRootPart.Position = StagePart.Position + Vector 3. new( 0 , 5 , 0 ) |
09 | print ( "Done!" ) |
10 | end ) |
11 | end ) |
The script is supposed to spawn a character on a stage part. The problem is that it doesn't do that. I have tried debugging it by print and I have tried doing it by Humanoid.Died as well. Also, Stage is a string value.
Hi! Try using CFrame instead. Fixed Code:
01 | game.Players.PlayerAdded:Connect( function (player) |
02 | print ( "Player Added Yay!" ) |
03 | local Stage = player:WaitForChild( "leaderstats" ):WaitForChild( "Stage" ) |
04 | player.CharacterAdded:Connect( function (character) |
05 | print ( "Character Added!" ) |
06 | local StagePart = game.Workspace:FindFirstChild(Stage.Value) --Just incase use the tostring() function to make a it a string. |
07 | print (StagePart) |
08 | character.HumanoidRootPart.CFrame = CFrame * CFrame.new( 0 , 5 , 0 ) --Its supposed to be times not add btw |
09 | print ( "Done!" ) |
10 | end ) |
11 | end ) |