You can write your topic however you want, but you need to answer these questions:
What do you want to achieve?
I wanted to create an notification that shows on thr player not for everyone, if you enter a custom command that you made it will notifys the user example /respawn Notification UI will show and kt will says “Respawn requested”
What is the issue? I cannot find tutorials YouTube
What solutions have you tried so far? i found nothing on forum and tried to script but it didn’t worked
Firstly, you need a server-side script to detect the command.
In order to make it only show for one client, you need to make the necessary GUI under StarterGui, and have a RemoteEvent in ReplicatedStorage. This would be what it might look like server-side:
--where the 'player' variable is the desired player object and 'text' variable is the desired text
game.ReplicatedStorage.RemoteEvent:FireClient(player, text) --change to your remote event
Now, make sure that the client-side TextLabel is enabled, but Visible is set to false.
Put a LocalScript under the designated TextLabel and connect it to the remote event.
local event = game.ReplicatedStorage:WaitForChild("RemoteEvent") --change to your event
event.OnClientEvent:Connect(function(text)
script.Parent.Visible = true
script.Parent.Text = text
wait(2)
script.Parent.Visible = false
end)
What the code will do is fire the event from the server, and the player variable tells the server which client to deliver the information to.
Then, when the client receives the information, it will set the notification TextLabel’s Text property to whatever was passed down the RemoteEvent. You can modify what it will change to in the server-side script.
local replicated = game:GetService("ReplicatedStorage")
local remote = replicated:FindFirstChild("RemoteEvent")
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
if message:lower():sub(1,8) == '/respawn' then
remote:FireClient(player)
end
end)
end)
Local Script
local replicated = game:GetService("ReplicatedStorage")
local remote = replicated:WaitForChild("RemoteEvent")
debounce = false
remote.OnClientEvent:Connect(function(Message)
if debounce == false then
debounce = true
wait(.1)
game.StarterGui:SetCore("SendNotification",{
Title = "Success!",
Text = "Respawn requested.",
Time = 5 ---time in seconds
})
wait(10)
debounce = false
end
end)
Well to get the message from the chat, you can do something like this;
--- Server Script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage:WaitForChild("Event")
game:GetService('Players').PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message)
if Message == "/Respawn" then
Event:FireClient(Player)
end
end)
end)
--- Local Script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage:WaitForChild("Event")
Event.OnClientEvent:Connect(function()
--Update GUI
end)
And then simple Update the GUI however you need. (Updated)