I am currently trying to make an announcement command for my admin, what I’m trying to do is when someone did :m
it would do :FireAllClient and change the gui on a local script. But what I did here only shows for the person who did the command, can someone tell me why?
Server Script:
if cmd:lower() == prefix.."m" and level3 then
if args[2] == nil or args[2] == "" then
local gui = script.Parent.Guis.ErrGui:Clone()
gui.ErrText.Text = "Incorrect Command Usage: "..prefix.."m <message>"
gui.Parent = player.PlayerGui
game:GetService("TweenService"):Create(player.PlayerGui.ErrGui.ErrText, TweenInfo.new(1), {TextTransparency = 0}):Play()
wait(1)
game:GetService("TweenService"):Create(player.PlayerGui.ErrGui.ErrText, TweenInfo.new(1), {TextTransparency = 1}):Play()
elseif level3 then
local text = string.sub(msg, #cmd+1)
local filtered = game.Chat:FilterStringAsync(text, player, player)
local fulltext = filtered
game.ReplicatedStorage.MACoreGui:FireAllClients(player, "AnnGui", fulltext)
end
end
Local Script:
game.ReplicatedStorage.MACoreGui.OnClientEvent:Connect(function(player, guiName, fulltext)
local players = game.Players.LocalPlayer
if guiName == "AnnGui" then
if players.PlayerGui:WaitForChild(guiName).AnnFrame.Transparency == 1 then
players.PlayerGui:WaitForChild(guiName).AnnFrame.Names.Text = player.Name
player.PlayerGui:WaitForChild(guiName).AnnFrame.Icon.Image = game.Players:GetUserThumbnailAsync(player.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
game:GetService("TweenService"):Create(players.PlayerGui:WaitForChild(guiName).AnnFrame, TweenInfo.new(1), {Transparency = 0.5}):Play()
game:GetService("TweenService"):Create(players.PlayerGui:WaitForChild(guiName).AnnFrame.AnnText, TweenInfo.new(1), {BackgroundTransparency = 0.5}):Play()
game:GetService("TweenService"):Create(players.PlayerGui:WaitForChild(guiName).AnnFrame.AnnText, TweenInfo.new(1), {TextTransparency = 0}):Play()
game:GetService("TweenService"):Create(players.PlayerGui:WaitForChild(guiName).AnnFrame.Names, TweenInfo.new(1), {TextTransparency = 0}):Play()
game:GetService("TweenService"):Create(players.PlayerGui:WaitForChild(guiName).AnnFrame.Title, TweenInfo.new(1), {TextTransparency = 0}):Play()
game:GetService("TweenService"):Create(players.PlayerGui:WaitForChild(guiName).AnnFrame.Icon, TweenInfo.new(1), {ImageTransparency = 0}):Play()
wait(0.5)
while wait() do
for i = 1, #fulltext do
players.PlayerGui:WaitForChild(guiName).AnnFrame.AnnText.Text = string.sub(fulltext,1,i)
wait(0.1)
end
if player.PlayerGui:WaitForChild(guiName).AnnFrame.AnnText.Text == fulltext then
break
end
end
wait(#fulltext*0.01+1)
game:GetService("TweenService"):Create(players.PlayerGui:WaitForChild(guiName).AnnFrame, TweenInfo.new(1), {Transparency = 1}):Play()
game:GetService("TweenService"):Create(players.PlayerGui:WaitForChild(guiName).AnnFrame.AnnText, TweenInfo.new(1), {TextTransparency = 1}):Play()
game:GetService("TweenService"):Create(players.PlayerGui:WaitForChild(guiName).AnnFrame.AnnText, TweenInfo.new(1), {BackgroundTransparency = 1}):Play()
game:GetService("TweenService"):Create(players.PlayerGui:WaitForChild(guiName).AnnFrame.Names, TweenInfo.new(1), {TextTransparency = 1}):Play()
game:GetService("TweenService"):Create(players.PlayerGui:WaitForChild(guiName).AnnFrame.Title, TweenInfo.new(1), {TextTransparency = 1}):Play()
game:GetService("TweenService"):Create(players.PlayerGui:WaitForChild(guiName).AnnFrame.Icon, TweenInfo.new(1), {ImageTransparency = 1}):Play()
players.PlayerGui:WaitForChild(guiName).AnnFrame.AnnText.Text = ""
end
end
end)