TOPIC MERGED: Sometimes, it thinks it doesn't exist, Other times, it works

Sorry, but this post has been discontinued and merged. To read this post, scroll down…
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I made a script that uses a boolean value that when it’s turned on, it freezes the player.

  2. What is the issue? Include screenshots / videos if possible!
    Sometimes, it goes through, but where there are delays and/or slow internet connections.
    Picture1Here is one involving my Gui. Picture2 And here’s another with my Boollean value (BoolValue).

Here’s a video if you want to see it in action…

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Here are the script that I tried/used so far:
-- Local Script --
local LocalPlr = script.Parent.Parent
local PlayerModule = require(LocalPlr.PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()

while true do
	if script.Parent.Parent.PlayerGui.AlreadyDid.Value == false then
		Controls:Disable()
	elseif script.Parent.Parent.PlayerGui.AlreadyDid.Value == true then
		Controls:Enable()
	end
end
-- Local Script --
local LocalPlr = script.Parent.Parent
local PlayerModule = require(LocalPlr.PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()

while true do
	wait(0.05)
	if script.Parent.Parent.PlayerGui.WelcomeGui.Frame.BackgroundTransparency == 1 then
		script.Parent.Parent.PlayerGui.AlreadyDid.Value = true
	end
end

and yes, I looks in the developer hub (mostly, but not always)

2 Likes

you should NEVER loop through each value. This is what the .Changed is for and is WAY more efficient. It is probably the UI not loading in fast enough so I recommend using WaitForChild() on the weclome gui and bool value.

1 Like

Thank you for the solution! I will edit my script and see if that helps.

1 Like

@jakebball11 Also, I just didn’t know what to used the Instance.Changed event properly, so I was simply using wait() as a placeholder…

NOTE: THIS TOPIC WILL BE CONTINUED INTO A MORE RECENT POST: