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

Help with this Button script?

Asked by 9 years ago

So, I've been trying to learn events, functions, etc. I got this script. There's no output errors (apart from some odd http://roblox.com/aspx stuff) and I just don't know what's wrong with it.~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~

local Franku = game.Workspace.Franku

function onTouch ()
Franku.Humanoid.Health = 0

end

local TextButton = game.StarterGui.Frame.ScreenGui.TextButton

TextButton.MouseButton1Down:connect(onTouch)

0
@dyler3, for some reason, when I'm clicking the button, it just doesn't work. No output errors.. it's just not working. Fireblader7470 0 — 9y

1 answer

Log in to vote
0
Answered by
dyler3 1510 Moderation Voter
9 years ago

Updated: So I found the problem. First, you want to take the screengui out of the frame and just put the screengui inside of the startergui. You can delete the frame after this. Next, delete the localscript, and put a regular script inside of the textlabel and then insert this into the script:

Franku = game.Workspace.Franku

function onTouch()
    print("Clicked")
    Franku.Humanoid.Health = 0
end

script.Parent.MouseButton1Down:connect(onTouch)

Sorry about that the first time :P. Anyways, this is tested and works. Lol, Hope I helped.

Ad

Answer this question