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

Why is the GUI not turning visible when a value has been changed?

Hello everyone! I have a script which changes a player value's value (a player value) and a local script which detects when the value has been changed. If it was, it will make a UI visible.

local player = game.Players.LocalPlayer
local CODR = player:WaitForChild("CODR") -- a boolean value
CODR.Changed:Connect(function(val)
	script.Parent.Visible = true
end)

But the UI was not turning visible. I decided to add a print statement in front of the line telling the UI to turn it visible saying "script.Parent.Visible". the Output printed 'true'

local player = game.Players.LocalPlayer
local CODR = player:WaitForChild("CODR") -- a boolean value
CODR.Changed:Connect(function(val)
	script.Parent.Visible = true
	print(script.Parent.Visible) -- output printing true
end)

Output = true but the UI is not turning visible By the way, the script thats changing the value is located in a model in the workspace

4 comments

0

is the screen gui enabled?

0

Yes

0

When I make it visible on the studio, it works

0

send pics of workspace while ur in game

2 answers

Hello there.

If its a Boolean value, there's really no need to use

CODR.Changed

Instead, you could use a while loop

while true do
	wait(0.00001)
	if CODR.Value == true -- or false then
		script.Parent.Visible == true
	end
end)

I hope this answers your question

  • RetroBuild / IBulid3

P.S. if you change the value to false then do this in the script

while true do
	wait(0.00001)
	if CODR.Value == false -- or true then
		script.Parent.Visible == false
	end
end)

1 comment

0

I need the local script to run when a part has been touched (which is why I used the script)

Hello everyone, I have solved the problem myself! Apparently I had to make the UI visible on the script instead of in the local script but I have no clue why

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