Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

LocalScript that should enable a gui doesnt work, what to do?

Asked by 2 years ago

Hello, ive made a localscript that gets enabled by a normal script that should enable a value and a gui, but it doesnt seem to work at all. The localscript gets enabled and all but it just doesnt do anything. The LocalScript is also inside the StarterPlayerScripts folder, ive tried multiple before but it didnt work. Heres the code that I made.

The MaskGui is a Gui that is disabled in StarterGui. The MaskValue is just a BoolValue in ServerStorage, its not too important.

local MaskGui = game.Players.LocalPlayer.PlayerGui.Mask
local MaskValue = game.ServerStorage.WearsMask

    MaskGui.Enabled = true
    MaskValue.Value = true

Also heres the code that I used to enable the localscript, it is inside a ProximityPrompt. MaskScript is the LocalScript that should run the code above.

local ProximityPrompt = script.Parent

ProximityPrompt.Triggered:Connect(function(player)
    game.StarterPlayer.StarterPlayerScripts.MaskScript.Disabled = false
end)

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago
  1. Every child/descendants of StarterPlayerScripts are reparented into: game.Players > plrInstance > PlayerScripts

(assuming it's a server script) 2. Server Scripts (Regular Scripts) can't access game.Players.LocalPlayer

  1. Client Scripts (LocalScript) can't access ServerStorage nor ServerScriptService

You will have to use RemoteEvent to do this, and that's probably only one of the thousand's ways of doing it.

0
Thank you, ill be sure to use that information. NEMOTASTlC 7 — 2y
Ad

Answer this question