Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I made a shout gui but the shout is only showing for me. How do I fix it?

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?

6 comments

0

Have you considered using :FireAllClients() with remote events?

0

Also, if you want it to show, you have to make the parents of Frame visible too. If a child of a hidden frame is showing, it will still be hidden.

0

What does :FireAllClients() do?

0

It fires a remote event to all clients connected to the server

0

Is FilteringEnabled on or off?

0

off for now. Because everything else doesnt work if its on :|

2 answers

✓ Accepted answer

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 :)

4 comments

0

It does not work :| I did everything you told me. I tested it in a game and im still the only one that can see this

0

Any errors?

0

Any errors?

0

Nvm it works I did something wrong. :P sry about that

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)

3 comments

0

Script is wrong :/ for players, in pairs(game.Players:GetChildren()) do is not right. Idk why tho

0

My bad, fixed it

0

Stll does not work :|

This discussion is preserved as it was. New answers, comments, and votes are closed.