Hello! So I have a Team Change Gui, and I want the player to change sizes when they press one of the buttons. For some reason, it doesn't work. Can you help me identify my problem?
function PlayerSize(player) local SizeValue = 0.5
1 | script.Parent.Button.MouseButton 1 Click:Connect( function (player) |
2 | local humanoid = player.Character.Humanoid |
3 | if humanoid then |
4 | if humanoid:FindFirstChild( "BodyHeightScale" ) then |
5 | humanoid.BodyHeightScale.Value = SizeValue |
6 | end |
7 | end |
end) end
Make sure this is in a local script also make sure you get the player and the character by doing the below code. And make sure it's in this is in a local script parented in startergui
01 | script.Parent.Button.MouseButton 1 Click:Connect( function (player) |
02 | wait() |
03 | if game.Players.LocalPlayer then |
04 | local character = game.Players.LocalPlayer.Character |
05 | if character then |
06 | local humanoid = character:FindFirstChild( "Humanoid" ) |
07 | if humanoid then |
08 | if humanoid:FindFirstChild( "BodyHeightScale" ) then |
09 | humanoid.BodyHeightScale.Value = (. 5 ) |
10 | end |
11 | end |
12 | end |
13 | end |
14 | end ) |