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

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

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

✓ Accepted answer
  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.

1 comment

0

Thank you, ill be sure to use that information.

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