I have to post this again because for some reason no one gets the problem
Summary: I have a GUI that enables itself when a RemoteEvent is called. 15 seconds after this RemoteEvent is called/ the gui is enabled, it because unenabled.
Problem: In most situations, after 15 seconds the player is still firing the GUI, making it enabled. Because of the constant back of forth from the deactivation (from the remote event 15 seconds ago) and the activation (from the latest remoteevent), it has a flickering event, seen in the video.
External MediaI have an idea for a solution but I don’t know how to script it. My idea is to make it de activate after 15 seconds after the LATEST RemoteEvent, and not EACH INDIVIDUAL RemoteEvent. I need help scripting this cuz i have no idea what to do.
Here is the script for the UI:
event.OnClientEvent:Connect(function(part, minus)
if part:IsA("Terrain") == false then
active = true
--print("Client recieved.")
--print(part.Name)
--print(tostring(minus))
local hp:number = UIFunction.GetHp(part)
local maxHp = UIFunction.getMaxHp(part)
if hp then UIFunction.Damage(part, minus, hp) end
UIFunction.UpdateUI(part.Name, maxHp, hp)
if hp == 0 then
UIFunction.Finish(part)
end
wait(15)
player.PlayerGui:WaitForChild("BreakingBar").Enabled = false
end
end)
For clarity (Because last time I asked no one understood it…):
UIFunction.UpdateUI() is the one that enables it.
The wait(15) and the last line is the one that de activates it.
I do not have a problem with disabling it on each time. I need help de activating it on the LATEST RemoteEvent. The de activation has nothing to do with the if hp == 0 then
thread.
Thank you for the help