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.
✓ ANSWER ACCEPTED
How to change the height values if they are on a certain team roblox?
2 answers
✓ Accepted answer
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.
2 comments
0
try waiting a bit longer, otherwise idk
0
Did not work, and no errors. I will just give you the answer, due to I am clueless
This discussion is preserved as it was. New answers, comments, and votes are closed.

9 comments
I get a error that states: ServerScriptService.Script:14: attempt to perform arithmetic (mul) on Instance and number
OOoops you have to add .Value after all the BodyScale thingies
Current Script
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.Char
And it still does not work.
what's the error now
Attempt to call a nil value
????????????? on what line
I posted something down below, because it would not let me paste code here.