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

Humanoid BodyHeight value doing nothing?

I tried to make a script where when you touch this orb, you become a bit taller. When you touch the orb, my character stays the same, but all the other code runs fine. Just so you know, this is a normal script inside the HeightOrb part in the workspace. Heres the script:

script.Parent.Touched:Connect(function(hit)
	
	local hum = hit.Parent:FindFirstChild("Humanoid")
	
	if hum then
		
		game.Players.PlayerAdded:Connect(function(Player)
			Player.CharacterAdded:Connect(function(Character)
				wait(3)

				local Humanoid = Character.Humanoid

				Humanoid.BodyHeightScale.Value = 2
				
			end)
		end)

		
		game.Workspace.HeightOrb.Transparency = 1
		game.Workspace.HeightOrb.CanCollide = false
		wait(5)
		game.Workspace.HeightOrb.Transparency = 0
		game.Workspace.HeightOrb.CanCollide = true
	end
end)


Thanks!

1 answer

You're not using hit at all. Use hum instead.

local debounce = false
script.Parent.Touched:Connect(function(hit)
	local hum = hit.Parent:FindFirstChildOfClass("Humanoid")
	if hum and game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) and not debounce then
		debounce = true
		hum.BodyHeightScale.Value = 2
		
		script.Parent.Transparency = 1
		script.Parent.CanCollide = false
		task.wait(5)
		script.Parent.Transparency = 0
		script.Parent.CanCollide = true
		debounce = false
	end
end)

4 comments

0

It works, but when i go over the orb again, it does not. Is there any way this can work? Thanks

0

What do you mean by "not working"? Be specific please. :)

0

Well just from looking at it, you dont have any code to increase the scale everytime you touch it. you set it to 2 and everytime it runs, its only set to 2 maybe try using the += assignment to increment it. unless bodyscale works in some weird way...

0

That could be, but it might be not. Maybe he's trying to increase it once, or maybe increase multiple times. I don't know.

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