Hello, so I have a button that allows you to change your team, but if you keep changing it, your character seems to get shorter and shorter, but I want it to just change to the defined sizes in the script on each team and not get smaller and smaller each time you change teams. Here is the code.
print("hi")
local teamSizeIndex = {
Parents = 1,
Teens = 0.9,
Kids = 0.85
}
local function updateSize(player)
print("HIIIIIIIIIIIIIIIIIII 2")
wait(0.1)
-- give a little bit of time for things to load
if player.Team then
local char = player.Character
local size = teamSizeIndex[player.Team.Name]
char.Humanoid:MoveTo(char.HumanoidRootPart.Position + Vector3.new(0,3,0))
char.Humanoid.BodyHeightScale.Value *= size
char.Humanoid.BodyWidthScale.Value *= size
char.Humanoid.BodyDepthScale.Value *= size
char.Humanoid.HeadScale.Value *= size
end
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
updateSize(player)
end)
player:GetPropertyChangedSignal("Team"):Connect(function()
print(player.Team)
updateSize(player)
end)
end)