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

When I press my GUI Button, nothing activates?

Code:

local button = script.Parent

local Plrs = game:GetService("Players")

local rs = game:GetService("ReplicatedStorage")
local remote = rs:WaitForChild("toRemote")

Plrs.PlayerAdded:Connect(function(player)
	script.username.Value = player.Name
end)

local char = game.Workspace:WaitForChild(script.username.Value)
local plr = Plrs:GetPlayerFromCharacter(char)

button.MouseClick:Connect(function()
	print("Done!")
	remote:FireClient(game.Players:FindFirstChild(plr))
	print("Done!")
end)

When I press the button, nothing happens. It doesn't print "Done!" either time, and I am very confused. Any help is appreciated.

1 comment

0

please use a code block

1 answer

Use :MouseButton1Click instead of :MouseClick. MouseClick isn't a property of any GuiObject.

1 comment

0

Thanks! It works now

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