If I don’t explain myself, what I am trying to do is that this script will detect for the player’s size to be above 15000 and if it is above 15000, then change the size to 15000 and like that.
if humanoid:WaitForChild("BodyDepthScale").Value >= 15000 then
return 15000 end
if humanoid:WaitForChild("BodyHeightScale").Value >= 15000 then
return 15000 end
if humanoid:WaitForChild("BodyWidthScale").Value >= 15000 then
return 15000 end
if humanoid:WaitForChild("HeadScale").Value >= 15000 then
return 15000 end
I’m pretty sure it doesn’t work this way. You’re suppose to set the values like below.
if humanoid:WaitForChild("HeadScale").Value >= 15000 then
humanoid.HeadScale.Value = 15000
end
--- Do the same thing for the other ones
if humanoid:WaitForChild("BodyDepthScale").Value > 15000 then
humanoid.HeadScale.Value = 15000
if humanoid:WaitForChild("BodyHeightScale").Value > 15000 then
humanoid.HeadScale.Value = 15000
if humanoid:WaitForChild("BodyWidthScale").Value > 15000 then
humanoid.HeadScale.Value = 15000
if humanoid:WaitForChild("HeadScale").Value > 15000 then
humanoid.HeadScale.Value = 15000
end
Each if block must end with an ‘end’.
if humanoid:WaitForChild("BodyDepthScale").Value > 15000 then
humanoid.HeadScale.Value = 15000
end
if humanoid:WaitForChild("BodyHeightScale").Value > 15000 then
humanoid.HeadScale.Value = 15000
end
if humanoid:WaitForChild("BodyWidthScale").Value > 15000 then
humanoid.HeadScale.Value = 15000
end
if humanoid:WaitForChild("HeadScale").Value > 15000 then
humanoid.HeadScale.Value = 15000
end
Also change the ‘.HeadScale.Value’ to the right limbs. You don’t want all of them to change the headscale.
i’m guessing that your’re saying that your script does “work” it just doesn’t do what you want it to. Also i’m guessing you have more to your script right?, because you are using a player variable up there. it’s likely not working how you want it to because you aren’t limiting the size in your strength event and when you do return 15000 you are stopping the rest from running and this isn’t really “returning” to anything (like swordphin mentioned) . What i would do is use math.clamp instead and do something like this:
local MinSize = 1 --- you can change these
local MaxSize = 15000
local function SetSize(humanoid, size)
humanoid:WaitForChild("BodyDepthScale").Value = size
humanoid:WaitForChild("BodyHeightScale").Value = size
humanoid:WaitForChild("BodyWidthScale").Value = size
humanoid:WaitForChild("HeadScale").Value = size
end
player.CharacterAppearanceLoaded:Connect(function(character)
local humanoid = character.Humanoid
local Size = math.clamp( 1 + (strength.Value / 1500), MinSize, MaxSize)
SetSize(humanoid, Size)
humanoid.WalkSpeed = 16 + (strength.Value / 100)
strength:GetPropertyChangedSignal("Value"):Connect(function()
local humanoid = character.Humanoid
local Size = math.clamp( 1 + (strength.Value / 1500), MinSize, MaxSize)
SetSize(humanoid, Size)
humanoid.WalkSpeed = 16 + (strength.Value / 100)
end)
end)
Changed it, but the error will still display saying that it expected end to close a function but if I add end then it will show that global player or global character is unknown.