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

could someone help me on a ui click brick it not working.?

Here's my script.

local clickDetector = script.Parent
local brickClickedEvent = game.ReplicatedStorage.Events.BrickClicked

clickDetector.MouseClick:Connect(function(player)
		brickClickedEvent:FireClient(player)
		print(player.Name.. "has clicked the brick")
		 game.StarterGui.TableFinder.Enabled = true
	end
end)

the GUI won't appear help?

everything is in the correct place.

2 answers

✓ Accepted answer

You are using the wrong location to find the gui element, try this:

local clickDetector = script.Parent
local brickClickedEvent = game.ReplicatedStorage.Events.BrickClicked
local player = game.Players.LocalPlayer

clickDetector.MouseClick:Connect(function(player)
	if not false then
		brickClickedEvent:FireClient(player)
		print(player.Name.. "has clicked the brick")
		player.PlayerGui.TableFinder.Enabled = true
	end
end)

Also, a more simple way to do it is to make the gui's visibility false. If you do that way, use this:

local clickDetector = script.Parent
local brickClickedEvent = game.ReplicatedStorage.Events.BrickClicked
local player = game.Players.LocalPlayer

clickDetector.MouseClick:Connect(function(player)
	if not false then
		brickClickedEvent:FireClient(player)
		print(player.Name.. "has clicked the brick")
		player.PlayerGui.TableFinder.Visible= true
	end
end)

instead of changing screen gui, use a localscript in startergui which on an event changes game.Players.LocalPlayer.PlayerGui.YourGui to enabled/disabled

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