Hello, I’m trying to make a Notification Button/Gui that shows the name of the player who clicked the button.
I already made the Button that shows a Gui to All clients. I’m only missing the code that shows the player name who clicked the Button.
Here are my scripts:
Local Script inside of TextLabel:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = Players.LocalPlayer
local newPlayerEvent = ReplicatedStorage:WaitForChild("CAUGHT_IN_4K_BACKROOMS1")
local playerGui = player:WaitForChild("PlayerGui")
local ploppy = script.Parent
local function onNewPlayerFired()
ploppy.Visible = true
ploppy.Text = "Caught in 4k 😳 📸 --> "..player.Name
wait(6)
ploppy.Visible = false
end
newPlayerEvent.OnClientEvent:Connect(onNewPlayerFired)
Local Script that Shows Notification:
local Player = game:GetService("Players").LocalPlayer
local function callback(Text)
if Text == "yes" then
print(Player.Name)
game.ReplicatedStorage.CAUGHT_IN_4K_BACKROOMS:FireServer()
elseif Text == ("bruh") then
print ("NEVER GONNA GIVE YOU UP")
end
end
local NotificationBindable = Instance.new("BindableFunction")
NotificationBindable.OnInvoke = callback
while true do
wait(10)
game.StarterGui:SetCore("SendNotification", {
Title = "Sans";
Text = "Placeholder";
Icon = "http://www.roblox.com/asset/?id=5018130938";
Duration = "10";
Button1 = "yes";
Button2 = "bruh";
Callback = NotificationBindable;
})
end
ServerSide Script:
local Players = game:GetService("Players")
local Player = game:GetService("Players").LocalPlayer
local newPlayerEvent = game.ReplicatedStorage.CAUGHT_IN_4K_BACKROOMS1
local sans = game.Workspace.Sans
bruh = true
game.ReplicatedStorage.CAUGHT_IN_4K_BACKROOMS.OnServerEvent:Connect(function(player)
game.Workspace.Alerted:Play()
newPlayerEvent:FireAllClients()
print(Player.Name)
end)