Answered by
6 years ago Edited 6 years ago
Your script is working exactly as it should. It's updating the Gui in StarterGui
. This means that you won't see the change until your character reloads, as the contents of StarterGui
are cloned into each player's PlayerGui
folder on CharacterAdded
. To fix this, all you need to do is get the Gui from the PlayerGui
folder using a RemoteEvent
, because the server cannot do this.
3 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
4 | local Remote = Instance.new( "RemoteEvent" ) |
5 | Remote.Parent = ReplicatedStorage |
7 | script.Parent.ClickDetector.MouseClick:Connect( function (player) |
8 | Remote:FireClient(player, "" ) |
03 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
04 | local Remote = ReplicatedStorage:WaitForChild( "RemoteEvent" ) |
05 | local player = game:GetService( "Players" ).LocalPlayer |
07 | Remote.OnClientEvent:Connect( function (args) |
08 | if player.PlayerGui:FindFirstChild( "PurchaseGui" ) then |
09 | player.PlayerGui.PurchaseGui.PurchaseFrame.Visible = true |
Note that Local Scripts
will only run when they are or were at some point a direct descendant of the player. This includes places like StarterPack
, StarterGui
, and StarterPlayerScripts
.
Resources:
Local Script
Accept and upvote if this helps!