My code is this, for the client:
01 | game.ReplicatedStorage.Classes.Say.OnClientEvent:Connect( function (msg, from, inclass) -- I hope this works... - Toby |
02 | for i = 1 , #inclass do |
03 | if i = = game.Players.LocalPlayer.Name then |
04 | local gui = game.ReplicatedStorage.InClass:Clone() |
05 | gui.Frame.Message.Text = msg |
06 | gui.Frame.From.Text = from |
07 | gui.Parent = game.Players.LocalPlayer.PlayerGui |
08 | wait( 3 ) |
09 | gui:Destroy() |
10 | end |
11 | end |
12 | end ) |
And to fire, from the server, we do this:
1 | local playerTable = { player.Name } |
2 | game.ReplicatedStorage.Classes.Say:FireAllClients( "Secret society doesn't work!" , "Server Message!" , playerTable) |
3 | print (player.Name) |
4 | print ( "This place hasn't been made!" ) |
The prints, on the server script, fires. But the Gui doesn't pop up, and worse of all, there are no errors...
Thanks for reading this, I really hope that you can help me. - Toby
uh i think these
1 | local playerTable = { player.Name } |
2 | repeat |
3 | wait( 0.2 ) |
4 | game.ReplicatedStorage.Classes.Say:FireServer( "Secret society doesn't work!" , "Server Message!" , playerTable) |
5 | until game.ReplicatedStorage.Classes.Say:FireServer( "Secret society doesn't work!" , "Server Message!" , playerTable) |
I found out that "i", on the local script, is a number, not a name. And I edited LocalPlayer.PlayerGui, to something else. So my local script should look like this:
01 | game.ReplicatedStorage.Classes.Say.OnClientEvent:Connect( function (msg, from, inclass) -- I hope this works... - Toby |
02 | for i = 1 , #inclass do |
03 | if inclass [ i ] = = game.Players.LocalPlayer.Name then |
04 | local gui = game.ReplicatedStorage.InClass:Clone() |
05 | gui.Frame.Message.Text = msg |
06 | gui.Frame.From.Text = from |
07 | local localplayerName = game.Players.LocalPlayer.Name |
08 | gui.Parent = game.Players:FindFirstChild(localplayerName).PlayerGui |
09 | wait( 3 ) |
10 | gui:Destroy() |
11 | end |
12 | end |
13 | end ) |
Thanks for reading this. - Toby