Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Lualaxy 78
6 years ago

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?

0
Have you considered using :FireAllClients() with remote events? ThatPreston 354 — 6y
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. ThatPreston 354 — 6y
0
What does :FireAllClients() do? Lualaxy 78 — 6y
0
It fires a remote event to all clients connected to the server User#20388 0 — 6y
View all comments (2 more)
0
Is FilteringEnabled on or off? hellmatic 1523 — 6y
0
off for now. Because everything else doesnt work if its on :| Lualaxy 78 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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

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 Lualaxy 78 — 6y
0
Any errors? User#20388 0 — 6y
0
Any errors? User#20388 0 — 6y
0
Nvm it works I did something wrong. :P sry about that Lualaxy 78 — 6y
Ad
Log in to vote
0
Answered by
hellmatic 1523 Moderation Voter
6 years ago
Edited 6 years ago
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)
0
Script is wrong :/ for players, in pairs(game.Players:GetChildren()) do is not right. Idk why tho Lualaxy 78 — 6y
0
My bad, fixed it hellmatic 1523 — 6y
0
Stll does not work :| Lualaxy 78 — 6y

Answer this question