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

Help with this Button script?

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)

1 comment

0

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

1 answer

✓ Accepted answer

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.

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