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

MouseButton1Down not firing? [Found Problem]

.Chatted fires when I chat, but .MouseButton1Down doesn't fire when clicked?

script.Parent.Increase.SurfaceGui.TextButton.MouseButton1Down:connect(function ()
		print("1") --does not print print when clicked
end)
game.Players:WaitForChild("magiccube3").Chatted:connect(function (msg)
		print("2") -- prints when i chat
	print(msg)
end)

Update: Caused by a line in another script enabling FilteringEnabled.

2 answers

Actually, I know this works in a new game I started making, last week, and is still in progress. I have buttons for all of my ingredients. However, when I do my testing, I always run it in server/client mode, and since the SurfaceGUIs are in the 3D world, controllable server-side, I have to switch over to the Server instance, for them to work - they never work in client. Are you sure this isn't what's happening - you're trying to test from the client?

Originally, I was making the mistake of trying to press the buttons in the client of studio, and thinking it was broke.

try function mouseclicked() --code end script.Parent.Increase.SurfaceGui.TextButton.MouseButton1Click(mouseclicked)

2 comments

0

Thats not it. I tested it just because why not and it didn't work. Also its .MouseButton1Click:connect(functionname).

0

woops yea forgot the :connect

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