local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Str)
if (string.sub(Str, 1, 6) == "!tweet") then
local Msg = string.sub(Str, 8, string.len(Str))
Player.PlayerGui.NotificationGui.Enabled = true
Player.PlayerGui.NotificationGui.TextLabel.Text = Msg
Player.PlayerGui.NotificationGui.PlayerName.Text = Player.Name .. " Tweeted:"
wait(5)
Player.PlayerGui.NotificationGui.Enabled = false
end
end)
end)
and as you can see its basically making a gui visible that has the players name and what he said in the gui, the problem is that i don’t know how to enable the gui for everyone, it only gets enabled for the player that said it, can yall help?
local remoteEvent = --your remote here..
local players = game.Players
players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if msg:sub(1,6) ~= "!tweet" then return end
local Message = msg:sub(8,string.len(msg))
remoteEvent:FireAllClients(Message,plr.Name)
end)
end)
and then in the client:
local remoteEvent = --your remote event..
local player = game.Players.LocalPlayer
local UI = player.PlayerGui.NotificationGui
remoteEvent.OnClientEvent:Connect(function(Message : string,Name : string)
UI.Enabled = true
UI.TextLabel.Text = Message
UI.PlayerName.Text = Name.." Tweeted:"
task.wait(5)
UI.Enabled = false
end)
the other is to just loop through each player’s playergui from the server and access their ui from there.
it really doesn’t matter, but you could put it inside the UI you want to move, this way instead of player.PlayerGui.YourUI you could just say script.Parent.
as long as you put it somewhere it runs, in it’s current state it should work.