Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Humanoid BodyHeight value doing nothing?

Asked by 2 years ago

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:

01script.Parent.Touched:Connect(function(hit)
02 
03    local hum = hit.Parent:FindFirstChild("Humanoid")
04 
05    if hum then
06 
07        game.Players.PlayerAdded:Connect(function(Player)
08            Player.CharacterAdded:Connect(function(Character)
09                wait(3)
10 
11                local Humanoid = Character.Humanoid
12 
13                Humanoid.BodyHeightScale.Value = 2
14 
15            end)
View all 25 lines...

Thanks!

1 answer

Log in to vote
1
Answered by 2 years ago

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

01local debounce = false
02script.Parent.Touched:Connect(function(hit)
03    local hum = hit.Parent:FindFirstChildOfClass("Humanoid")
04    if hum and game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) and not debounce then
05        debounce = true
06        hum.BodyHeightScale.Value = 2
07 
08        script.Parent.Transparency = 1
09        script.Parent.CanCollide = false
10        task.wait(5)
11        script.Parent.Transparency = 0
12        script.Parent.CanCollide = true
13        debounce = false
14    end
15end)
0
It works, but when i go over the orb again, it does not. Is there any way this can work? Thanks kickoff127 103 — 2y
0
What do you mean by "not working"? Be specific please. :) T3_MasterGamer 2189 — 2y
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... b2lego 30 — 2y
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. T3_MasterGamer 2189 — 2y
Ad

Answer this question