Stop GUI from flickering

Hey all, I was wondering how I would could make it so the GUI doesn’t flicker once a player steps on it.

This is what it looks like: https://gyazo.com/efefe0223f9a64e322f28fcae1136108

I have got the current code, however I don’t know how to achieve this:

script.Parent.Touched:Connect(function(touch)
	local Player = game.Players:GetPlayerFromCharacter(touch.Parent)
	Player.PlayerGui.SafeGUI.Enabled = true
end)

script.Parent.TouchEnded:Connect(function(leave)
	local Player = game.Players:GetPlayerFromCharacter(leave.Parent)
	Player.PlayerGui.SafeGUI.Enabled = false
end)

I presume I could use some sort of debounce, but I’m not sure how I would do this as it’s a server script.

Using .TouchEnded is pretty glitchy. Try using Regions instead of .TouchEnded event also do not do this on server. You might want to fire a remote to client to do changes for their PlayerGui.

Here’s an open sourced module for Regions, pretty useful and easy to use:

1 Like

This helped greatly, appreciate it!