I am working on a Obby and I want to send a StarterGui SetCore SendNotificaiton but once the player reaches the end it spams every player infinitely with it? How do I make it only send once?
Here is my Code:
Client-Notification (in StarterGui):
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")
local Notification = ReplicatedStorage:WaitForChild("Notification")
Notification.OnClientEvent:connect(function(Title, Description, Image)
StarterGui:SetCore("SendNotification", {
Title = Title,
Text = Description,
Duration = 3,
Button1 = "Ok"
})
end)
Server-Notification (In ServerScriptService):
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Notification = ReplicatedStorage:WaitForChild("Notification")
while true do
wait(0.1)
for i, v in pairs(game.Players:GetPlayers()) do
if v.leaderstats.Level.Value == 7 then
Notification:FireAllClients(v.Name.." Finished", v.Name.." has finished the Obby!")
end
end
end

2 comments
You should clone the remote, and then after they finish it you should fire the clone and then destory the clone.
Or you can use the :Disconnect function. https://developer.roblox.com/en-us/articles/events/index.html