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

Enabled value not changing for a ScreenGui in a round game, know a fix?

I tried making a round-based game that would edit each player's ScreenGui that had options to teleport around. It would cut it off for 60 seconds and cut it back on for 15 seconds.

while true do 

wait(15) 

local plrs = game.Players:GetChildren() 
for i = 1, #plrs do 
	plrs[i].Character.HumanoidRootPart.CFrame = workspace.gameSpawn.CFrame
	plrs[i].PlayerGui.tps.Enabled = false 
end

wait(60) 

local plrs = game.Players:GetChildren() 
for i = 1, #plrs do 
	plrs[i].PlayerGui.tps.Enabled = true 
end 
end

It won't turn Enabled to true or false. Anyone know the reason why?

2 comments

0

Is tps a ValueObject?  This information could help me fix your problem

0

"tps" is a ScreenGui

1 answer

✓ Accepted answer

You need to add debounce:

local debounce = 0

while true do
	if debounce == 0
		debounce = 1
		wait(15) 
		local plrs = game.Players:GetChildren() 
		for i = 1, #plrs do 
			plrs[i].Character.HumanoidRootPart.CFrame = workspace.gameSpawn.CFrame
			plrs[i].PlayerGui.tps.Enabled = false 
		end
		wait(60) 
		local plrs = game.Players:GetChildren() 
		for i = 1, #plrs do 
			plrs[i].PlayerGui.tps.Enabled = true
		end
		debounce = 0
	end 
end

2 comments

0

This should work. Let me know if it doesn't, and how it doesn't

0

you forgot to change the debounce back to 0 btw

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