So I made a shout gui. First I put this following code into a localscript:
local GUI = script.Parent.ShoutBox local Players = game.Players.LocalPlayer if Players.Name == "SkullMasterHD" then GUI.Visible = true end
It allows me to shout stuff out and noone else can see the ShoutBox which is a frame "ShoutBox".
Then I have this other code in a normal scirpt:
local AText = script.Parent.Shout.Shout local Button = script.Parent.ShoutBox.TextButton local SText = script.Parent.ShoutBox.TextBox local Frame = script.Parent.Shout Button.MouseButton1Click:connect(function() script.Parent.Shout.Shout.TextScaled = true Frame.Visible = true AText.Text = SText.Text wait(5) Frame.Visible = false script.Parent.Shout.Shout.TextScaled = false end)
Which should display the other frame "Shout" to everyone and add the text that was typed into the box by an admin aka. me. Now the shout displays correctly with the text and everything only for me and noone else. What did I do wrong?
I'll answer the question again xD
First I want you to know that what you do is local (client side) what the server does is server side and will affect all players.
So how you want to fix this is by sending a message to the server and let the server send it to the other clients (players), you will have to do this using remote events.
First you need to add 2 remote events inside ReplicatedStorage. Called MessageServer and MessageClients
The first script needs to be the local script where you shout from.
local Event = game:WaitForChild('ReplicatedStorage'):WaitForChild('MessageServer') local Button = script.Parent.ShoutBox.TextButton local SText = script.Parent.ShoutBox.TextBox Button.MouseButton1Click:connect(function() Event:FireServer(SText.Text) -- Fires the event with the text in it end)
The second script needs to be located inside workspace, it needs to be a serverscript (or just a script as roblox doesn't say serverscript)
local Event = game:WaitForChild('ReplicatedStorage'):WaitForChild('MessageServer') local Event2 = game:WaitForChild('ReplicatedStorage'):WaitForChild('MessageClients) Event.OnServerEvent:connect(function(plr, message) Event2:FireAllClients(message) end)
The third script needs to be inside the message gui (where you putted the first local script too) and it needs to be a local script
local Event = game:WaitForChild('ReplicatedStorage'):WaitForChild('MessageClients) Event.OnClientEvent:connect(function(message) local AText = script.Parent.Shout.Shout local Frame = script.Parent.Shout script.Parent.Shout.Shout.TextScaled = true Frame.Visible = true AText.Text = message wait(5) Frame.Visible = false script.Parent.Shout.Shout.TextScaled = false end)
This should work. If it doesn't or you have any questions, just ask :)
local AText = script.Parent.Shout.Shout local Button = script.Parent.ShoutBox.TextButton local SText = script.Parent.ShoutBox.TextBox local Frame = script.Parent.Shout function onClick() --this basically finds ALL the players gui and make the frame for the text visible and changes the text to 'SText.Text' (suggest to edit it because I don't know the exact location of the ShoutGui and its Frame and TextButtons) for _, players in pairs(game.Players:GetChildren()) do if players.PlayerGui:FindFirstChild('NAME OF SHOUT GUI') then local ShoutGui = players.PlayerGui:FindFirstChild('NAME OF SHOUT GUI') ShoutGui.Shout.Shout.TextScaled = true ShoutGui.Frame.Visible = true ShoutGui.Shout.Shout.Text = SText.Text wait(5) ShoutGui.Frame.Visible = false ShoutGui.Shout.Shout.Textscaled = false end end end Button.MouseButton1Click:connect(onClick)