Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How To Make Screen GUI Appear When Touching Object And Then Disappear After 2.5 Seconds?

Asked by 4 years ago
Edited 4 years ago

So Basically I Want My Screen GUI To Disappear After The Wait Time. It Works Only Once Then Stops. I Am Not Sure How To Fix This. Here Is My Current Script RN.

local db = false

script.Parent.Touched:Connect(function(hit)
    if not db then
        db = true
        local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
        local h = hit.Parent:FindFirstChild("Humanoid")
        if plr and h then
            if plr.leaderstats.Endurance.Value < 250 then
                script.AcidGui:Clone().Parent = plr.PlayerGui 
                wait(2.5)
                plr.PlayerGui.AcidGui.Enabled = false
            end
        end
        wait(2.5)
        db = false      
    end
end)

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

You need to Local the clone of AcidGui, because in Line 12 you are referring to the original "AcidGui" and not the cloned one Try something like this, ON LINE 10:

Local ClonedAcidGui = script.AcidGui:Clone()
ClonedAcidGui.Parent = plr.PlayerGui
wait(2.5)
ClonedAcidGui:Remove()
0
I just edited it, copy it again benjinanas 50 — 4y
0
I Really Appreciate It, This Took Me Nearly 10 Hours To Do. And Your Answer Was The Only Correct One I Could Find Proskillez342 9 — 4y
Ad

Answer this question