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

Whenever I walk the gui goes away then comes back, is there any way I can fix this?

The script is the part:

local part = script.Parent
local debounce = false
part.Touched:Connect(
    function(hit)
        if debounce == false then
            debounce = true
            local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
            if plr then
                plr:WaitForChild("PlayerGui").Quest1.Frame.Visible = true
                ("PlayerGui").Quest1.Frame.Visible = true
            end
            wait(3)
            debounce = false
        else
            print("wait.........")
        end
    end
)
part.TouchEnded:Connect(
    function()
        if debounce == false then
            local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
            plr:WaitForChild("PlayerGui").Quest1.Frame.Visible = false
        end
    end
)



1 comment

0

that wouldnt work

1 answer

i have no idea what your problem is but this can help:

part = script.Parent
local debounce = false
part.Touched:Connect(
    function(hit)
        if debounce == false then
            debounce = true
            local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
            if plr then
                plr:WaitForChild("PlayerGui").Quest1.Frame.Visible = true
                ("PlayerGui").Quest1.Frame.Visible = true
            end
            wait(3)
            debounce = false
        else
            print("wait.........")
        end
    end
)
part.TouchEnded:Connect(
    function()
        if debounce == false then
            debounce = true
            local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
            plr:WaitForChild("PlayerGui").Quest1.Frame.Visible = false
            wait(3)
            debounce = false
        end
    end
)


what i did and how it may affect the debounce:

when the player waits for 3 seconds on the part, it will just glitch out when he gets off, so I added debounce to the touchended

btw touchended sucks

1 comment

0

Actually don't works, debounce is for all players as this is server script

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