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

HELP: GUI button script Problem! [Still not solved] D: ?

Asked by
Dr_Doge 100
9 years ago

This is what I have, and I think that my problem is with line 2 ( if Health == 0>30 then )

local Health = script.Parent.Parent.Parent.Parent.Character.humanoid.Health
if Health == 0>30 then

script.Parent.Parent.Parent.Parent.Character.humanoid.Health= "100"
script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(99.23, 149.962, -2.248)



end

3 answers

Log in to vote
1
Answered by
Dr_Doge 100
9 years ago

D:

Its still not working! This is the whole script! its in a GUI button.

Line 9 is't working eather! can someone give me a fix?

function MouseClick()
    wait(0)
    local numplaying = Game.Workspace.Game1.Players.Value;
    if numplaying == 0 or numplaying == 1 then


script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(19.6, 4.6, -27.6)
wait(0)
numplaying = (numplaying+1)



end
end

script.Parent.MouseButton1Down:connect(MouseClick)

local Health = script.Parent.Parent.Parent.Parent.Character.Humanoid.Health

if Health <=30 then

script.Parent.Parent.Parent.Parent.Character.Humanoid.Health= "100"
script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(99.23, 149.962, -2.248)



end

0
I'm confused on this. What's the first function supposed to do? Shawnyg 4330 — 9y
Ad
Log in to vote
0
Answered by
Vividex 162
9 years ago

Well, I see a couple of errors in the first two lines,

local health = script.Parent.Parent.Parent.Parent.Character.Humanoid.Health

You need to capitalize the H in Humanoid, in Lua, capitalization matters. Also, 0>30 is basically saying if 0 is greater than 30 (which it is not), then.. and thats why your script bellow Line 2 does not work, also remember to capitalize the H in humanoid on line 4 too.

So instead of 0>30, use

if Health <=30 then

<= is saying "less than or equal too 30" in Lua, as if you did >= that would mean "greater than or equal too.

Log in to vote
-1
Answered by 9 years ago

do if Health >= 30 that should work

Answer this question