I have a local script and a boolean value in StarterGui. This local script should change the value in folder at line 11, although for some reason it will not. Does it have anything to do with being a local script?
local part = workspace:WaitForChild("ActivateBurgerJob") local plr = game.Players.LocalPlayer; local PlayerModule = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule")) local Controls = PlayerModule:GetControls() local ui = script.Parent; canSeeGui = script.Parent.Parent:WaitForChild("canSeeGui").Value local function onTouch(hit) if plr.Character ~= nil and hit.Parent == plr.Character and canSeeGui == true then wait(0.2) canSeeGui = false Controls:Disable() ui.Enabled = true print("Contrls disbaled") end end part.Touched:Connect(onTouch)
While it is true that anything the local script does will not be reflected on the Server, if you're working just in local GUI, other local scripts will be able to read the value just fine. The real issue here is likely this:
canSeeGui = script.Parent.Parent:WaitForChild("canSeeGui").Value
Specifically, the .Value part of it. When you define a variable as the .Value, you're not actually defining it as the object & it's value, you're defining it as the actual literal value.
So assuming CanSeeGUI is a BoolValue, you're defining CanSeeGUI's variable as "True" rather than the BoolValue's current value. So when you set it to False, you're not actually changing the Bool Value, you're just making the local variable to False.
To fix just, just remove the .Value part, and add it in when you change it.
For instance, CanSeeGui.Value = false, rather than CanSeeGui = false.
This is a fairly common mistake even some elder programmers forget from time to time.