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

Why dosen't this script work?

I'm trying to make a GUI show up on a player who clicks on the brick, I have a clickdetector and all, and this is in a LocalScript. Code :

local Clicker = script.Parent.ClickDetector
local player = game.Players.LocalPlayer

Clicker.MouseClick:connect(function(player)
	game.StarterGui.PurchaseFarmGui.Frame.Visible = true
end)

1 answer

First off, you cant use LocalPlayer due to this most likely being in a regular script, but luckily for us, click detectors recognize the player who clicked it. Secondly, on line five the script is editing the source GUI, not the one that has been replicated to the player. So try this:

local Clicker = script.Parent.ClickDetector

Clicker.MouseClick:connect(function(player)
   	  player.PlayerGui.PurchaseFarmGui.Frame.Visible = true
end)


2 comments

0

Thanks ;)

0

Can you accept the answer please? :)

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