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

Need help with Click detector script? It's not increasing height

Asked by 4 years ago

I am making a game called Oreo Br I got the GUI done, the game logic is done (basically) but there's one problem I'm having, the OREO I have a click detector in my oreo model with a script located in my model, This script is SUPPOSED TO make your height increase but it's really not working can someone help me? here is my script for the oreo btw I haven't ever worked with body height and size so that's why this question is kind of stupid

01script.Parent.ClickDetector.MouseClick:connect(PlayerSize(player.Character)) -- I don't know if this was correct to pass in
02function PlayerSize(player)
03    local SizeValue = 1
04    local humanoid = player.Character.Humanoid
05    if humanoid then
06        if humanoid.FindFirstChild("BodyHeightScale") then
07            humanoid.BodyHeightScale.Value = humanoid.BodyHeightScale.Value + 1 --increase the body height
08        end
09    end
10end

1 answer

Log in to vote
1
Answered by
RAFA1608 543 Moderation Voter
4 years ago
Edited 4 years ago

The value BodyHeightScale is just a value for the storage of the scale of the body's height. It just stores. So, therefore, it doesn't do anything if you change it. Also, the function comes after you connect it to something. Edit: I dont know what exactly you would need to make a humanoid's body longer, in terms of height. Anyways, heres what i mean't by "The function comes before the connect()ing":

01function PlayerSize(player)
02    local SizeValue = 1
03    local humanoid = player.Character.Humanoid
04    if humanoid then
05        if humanoid.FindFirstChild("BodyHeightScale") then
06            humanoid.BodyHeightScale.Value = humanoid.BodyHeightScale.Value + 1
07        end
08    end
09end
10script.Parent.ClickDetector.MouseClick:connect(PlayerSize(player)) --comes after the function, not before the function gets defined. I don't know if that changes the functionality though.

And no, player.Character isnt the right thing to pass in due to this line:

1local humanoid = player.Character.Humanoid

There isn't a character inside a character. Hope this helped!

0
Thank you but can you tell me what I should use instead of bodyHeightScale, and what do you mean connect, I already connected look at this line. script.Parent.ClickDetector.MouseClick:connect(PlayerSize(player.Character)) also Is player.Character the right thing to pass in? ayuu_ondev 60 — 4y
0
Alright, i edited it. I hope that helped in some way. RAFA1608 543 — 4y
0
OK thamks Ill try :) ayuu_ondev 60 — 4y
0
OK thamks Ill try :) ayuu_ondev 60 — 4y
0
oops sorry for postig twice this website is kinda broken :/ ayuu_ondev 60 — 4y
Ad

Answer this question