Hello, I have this script to make sure the player stays the same size when they die, but it doesn’t work, I really need some help on this, heres the code
game.Players.PlayerAdded:Connect(function(LocalPlayer)
LocalPlayer.CharacterAdded:Connect(function(Character)
local char = LocalPlayer.Character or LocalPlayer.Character:Wait()
if LocalPlayer.CurrentTeam.Value == "Kid" then
LocalPlayer.char:WaitForChild("Humanoid"):WaitForChild("BodyWidthScale").Value = 0.6
LocalPlayer.char:WaitForChild("Humanoid"):WaitForChild("BodyDepthScale").Value = 0.6
LocalPlayer.char:WaitForChild("Humanoid"):WaitForChild("BodyProportionScale").Value = 0
LocalPlayer.char:WaitForChild("Humanoid"):WaitForChild("BodyTypeScale").Value = 0
LocalPlayer.char:WaitForChild("Humanoid"):WaitForChild("HeadScale").Value = 0.6
LocalPlayer.char:WaitForChild("Humanoid"):WaitForChild("BodyHeightScale").Value = 0.6
end
if LocalPlayer.CurrentTeam.Value == "Teen" then
LocalPlayer:WaitForChild("Character").Humanoid:WaitForChild("BodyWidthScale").Value = 0.9
LocalPlayer:WaitForChild("Character").Humanoid:WaitForChild("BodyDepthScale").Value = 0.9
LocalPlayer:WaitForChild("Character").Humanoid:WaitForChild("BodyProportionScale").Value = 0
LocalPlayer:WaitForChild("Character").Humanoid:WaitForChild("BodyTypeScale").Value = 0
LocalPlayer:WaitForChild("Character").Humanoid:WaitForChild("HeadScale").Value = 0.9
LocalPlayer:WaitForChild("Character").Humanoid:WaitForChild("BodyHeightScale").Value = 0.9
end
if LocalPlayer.CurrentTeam.Value == "Parent" then
LocalPlayer:WaitForChild("Character").Humanoid:WaitForChild("BodyWidthScale").Value = 1
LocalPlayer:WaitForChild("Character").Humanoid:WaitForChild("BodyDepthScale").Value = 1
LocalPlayer:WaitForChild("Character").Humanoid:WaitForChild("BodyProportionScale").Value = 0
LocalPlayer:WaitForChild("Character").Humanoid:WaitForChild("BodyTypeScale").Value = 0
LocalPlayer:WaitForChild("Character").Humanoid:WaitForChild("HeadScale").Value = 1
LocalPlayer:WaitForChild("Character").Humanoid:WaitForChild("BodyHeightScale").Value = 1
end
end)
end)
PlayerAdded will not work on a LocalScript tied to the player since the event fires before the PlayerScripts have loaded. Just remove that part and just define LocalPlayer (local LocalPlayer = game.Players.LocalPlayer)
Why are you defining the character completely different in the Kid code compared to all the others.
Kid Code:
game.Players.PlayerAdded:Connect(function(LocalPlayer) its just the parameter name and 2nd it was for testing to see if waiting for it would work, but it never did, if you have any solution to this please say it
what he is saying is that it cannot detect the player being added because you are the player and you arrive alongside the function that would be fired.
This isn’t a localscript haha, its a serverscript and this error ServerScriptService.TeamScripts.ResetTeamSize:31: attempt to index nil with ‘CharacterAdded’