I'm trying to insert a message into someone else's PlayerGui through a localscript. Is that possible? If so, how?
like a message as in
Instance.new('Message')
?
Coming from a noob, I think
local PlayerAdded = game.Players.PlayerAdded:connect(function(plr) local Message = Instance.new("Message",game.Players.LocalPlayer.PlayerGui) Message.Text = "You're text" end)
So when the Instance.New message goes into the LocalPlayers' PlayerGUI
If you're using FilteringEnabled (and possibly even if you're not, I'm not sure), you will need to have RemoteEvents. Assuming your RemoteEvent is in the workspace and is named RelayMessage
, something like this:
--Server script workspace.RelayMessage.OnServerEvent:connect(function(sender, target, msg) workspace.RelayMessage:FireClient(target, msg) end)
--Local script workspace.RelayMessage.OnClientEvent:connect(function(msg) --deal with msg here end) --Send a message to someone else like this: workspace.RelayMessage:FireServer(somePlayer, someMsg)
Note: a proper server-side function might make sure of the following things to prevent exploiters/hackers from doing too much damage: