I am making a adopt and raise type of game, and I was wondering how I would change a players height and width value to be set depending on their team they choose. Example: when they choose the kid team, how would I make the kids team change their size to a size I can make it that will represent a kid.
if your game uses R15, you can just use the body scaling values in the humanoid
you can run a function whenever the player changes their team or their character gets added to make sure that they're always that size
local teamSizeIndex = { -- your teams don't have to be named the same way, this is just an example Adult = 1, Teenager = 0.75, Child = 0.5 } game.Players.PlayerAdded:Connect(function(player) local function updateSize() wait(0.1) -- give a little bit of time for things to load if player.Team then -- make sure the player has a team, or else the function will error local char = player.Character local size = teamSizeIndex[player.Team.Name] char.Humanoid.BodyHeightScale *= size -- compound operators are Awesome char.Humanoid.BodyWidthScale *= size char.Humanoid.BodyDepthScale *= size char.Humanoid.HeadScale *= size end end player.CharacterAdded:Connect(updateSize) player:GetPropertyChangedSignal("Team"):Connect(updateSize) end)
if your game uses R6 then. you're screwed lol
there's no way to change body scaling with R6 unless you write your own function that manually changes the size of each limb and the position of the motor6ds on the character, which isn't exactly fun
local teamSizeIndex = { -- your teams don't have to be named the same way, this is just an example Parents = 1, Teens = 0.75, Kids = 0.5 } game.Players.PlayerAdded:Connect(function(player) local function updateSize() wait(0.1) -- give a little bit of time for things to load if player.Team then -- make sure the player has a team, or else the function will error local char = player.Character local size = teamSizeIndex[player.Team.Name] char.Humanoid.BodyHeightScale.Value *= size-- compound operators are Awesome char.Humanoid.BodyWidthScale.Value *= size char.Humanoid.BodyDepthScale.Value *= size char.Humanoid.HeadScale.Value *= size end end player.CharacterAdded:Connect(updateSize) player:GetPropertyChangedSignal("Team"):Connect(updateSize) end)
Is my current code, but it now has no error. But it does not work.