#How do I stop the Gui flickering?

1 messages · Page 1 of 1 (latest)

formal leaf
#

I am making it so when the player touches a part it opens a shop Gui, but every time the player walks it flickers to enabled to disabled. I know why this happens, but I do not know how to fix it.

Here's the script:
local shopGui = script.Parent
local shopGuiTrigger = game.Workspace.ShopGuiTrigger

shopGuiTrigger.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
local localPlayer = game.Players.LocalPlayer
if hum and localPlayer then
shopGui.Enabled = true
end
end)

shopGuiTrigger.TouchEnded:Connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
local localPlayer = game.Players.LocalPlayer
if hum and localPlayer then
shopGui.Enabled = false
end
end)

#

Nevermind I fixed it.