Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

When you click the button, you turn small, but it doesnt want to work?

when you click the button (gui) it makes you small

function onButtonClicked() local Character = game.Players.LocalPlayer local Humanoid = Character:FindFirstChild('Humanoid')

if Humanoid then
	local HEAD = Humanoid:FindFirstChild('HeadScale')
	local BodyWidthScale = Humanoid:FindFirstChild('BodyWidthScale')
	local BodyHeightScale = Humanoid:FindFirstChild('BodyHeightScale')
	local BodyDepthScale = Humanoid:FindFirstChild('BodyDepthScale')
	
	if HEAD then
		HEAD.Value = HEAD.Value - 0.7
		BodyDepthScale.Value = BodyDepthScale.Value - 0.7
		BodyHeightScale.Value = BodyHeightScale.Value - 0.7
		BodyWidthScale.Value = BodyWidthScale.Value - 0.7
	end
end
end

script.Parent.MouseButton1Click:connect(onButtonClicked)

' local Character = game.Players.LocalPlayer ' on that, 'player' is not found

2 comments

0

You should probably start by defining the "Humanoid" and also probably tell us where the heck local Character is? Because you posted half of your script

0

1.Please post the whole script that woudl help us all alot

1 answer

I can't tell you whats wrong because you didn't post the whole script

MAKE SURE ITS IN A LOCALSCRIPT!!! THE SCRIPT WITH A HUMAN ON IT!!!

short and simple script :

script.Parent.MouseButton1Click:connect(function()
  local Humanoid = game.Players.LocalPlayer.Character:FindFirstChild('Humanoid')
   Humanoid.HeadScale.Value = Humanoid.HeadScale.Value - 0.7
   Humanoid.BodyDepthScale.Value =  Humanoid.BodyDepthScale.Value - 0.7
   Humanoid.BodyHeightScale.Value =  Humanoid.BodyHeightScale.Value - 0.7
    Humanoid.BodyWidthScale.Value =  Humanoid.BodyWidthScale.Value - 0.7
end)

Longer script :


script.Parent.MouseButton1Click:connect(function()
	local Humanoid = game.Players.LocalPlayer.Character:FindFirstChild('Humanoid')
if Humanoid then
    local HEAD = Humanoid:FindFirstChild('HeadScale')
    local BodyWidthScale = Humanoid:FindFirstChild('BodyWidthScale')
    local BodyHeightScale = Humanoid:FindFirstChild('BodyHeightScale')
    local BodyDepthScale = Humanoid:FindFirstChild('BodyDepthScale')

    if HEAD then
        HEAD.Value = HEAD.Value - 0.7
        BodyDepthScale.Value = BodyDepthScale.Value - 0.7
        BodyHeightScale.Value = BodyHeightScale.Value - 0.7
        BodyWidthScale.Value = BodyWidthScale.Value - 0.7
    end
end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.