My problem is this I tried to enable my Gui variable but it will not work?
Cdetector = script.Parent.ClickDetector rp = game:GetService("ReplicatedStorage") status = rp:WaitForChild("StoneValue") Gui = game:GetService("StarterGui"):WaitForChild("HintGui") Cdetector.MouseClick:Connect(function() status.Value = status.Value + 1 --script.Disabled = true-- Gui.Enabled = true --[[for i = 0.1,1,0.3 do script.Parent.Stone1.Transparency = i wait(.1) script.Parent.Stone2.Transparency = i wait(.1) script.Parent.Stone3.Transparency = i end--]] end)
You need to retrieve HintGui
from the Player's own personal GUI, which is called PlayerGui
and can be found under Player
in the instance hierarchy.
When you change objects in StarterGui
, you only change the properties of objects which will, at some point in the future, be cloned to each player (either when they spawn or when they join the game).
When you modify things in PlayerGui
, you will be changing the actual GUI currently controlled by and displayed to a player.
EDIT: When you modify a Player's GUI, you have to have a reference to the Player whose GUI you want to modify.
ClickDetector
supplies a reference to the player that performed the click as one of the parameters to the MouseClick
event, so you can reference the Player
's GUI like this:
Cdetector = script.Parent.ClickDetector rp = game:GetService("ReplicatedStorage") status = rp:WaitForChild("StoneValue") Cdetector.MouseClick:Connect(function(player) -- <-- passed by MouseClick local Gui = player.PlayerGui:WaitForChild("HintGui") status.Value = status.Value + 1 Gui.Enabled = true end)