Hello everyone!
I was trying to create a message that this was recently stolen with the “SendNotification” service but I can’t find a way to do it, in the system that I am trying to add it is in a Proximityprompt. I think that’s all, if you don’t understand something tell me!
My purpose for this is to let the player know that the store was recently robbed and that they cannot rob it again for a period of time.
Thanks!
3 Likes
I didn’t understood what you meant very well, But i assume you want to send a Notification to the Player whenever they Prompt a ProximityPrompt, Correct?
If that’s what you want to accomplish, You can use:
- A RemoteEvent that will send Notification to the Client.
- Connect the RemoteEvent on the Client side by using
RemoteEvent.OnClientEvent:Connect()
.
- You can use StarterGui:SetCore() + SendNotification Core Function.
2 Likes
What I did was a store robbery with a proximity message, obviously you can’t rob every 5 seconds. I put a cooldown of 10 minutes, so my idea was to add a notification that the store was recently robbed so that the player knows that. Could you tell me an example of the script? please I don’t understand that very well
-- Server-Script under the ProximityPrompt
script.Parent.Triggered:Connect(function(Player)
local Event = Instance.new('RemoteEvent', game:GetService('ReplicatedStorage'))
Event.Name = 'Event'
Event:FireClient(Player)
end)
-- LocalScript in StarterGui
local StarterGui = game:GetService('StarterGui')
local Debounce = true
local function SendMessage()
StarterGui:SetCore("SendNotification", {
Title = 'Notification';
Text = 'This is a notification!';
Duration = 5;
})
end
game.ReplicatedStorage.Event.OnClientEvent:Connect(function()
if Debounce then
task.spawn(SendMessage())
Debounce = false
task.wait(10) -- How long you want a debounce to be.
Debounce = true
end
end)
That should work, though let me know of any difficulties! Hopefully this clears it up for you a bit more!
Resources:
SetCore
Task Library
2 Likes