✓ Accepted answer
Use RemoteEvents.
RemoteEvents can be used to communicate with the client and the server or server to client, or even client to client and server to server!
RemoteEvents can also be used to manipulate GUIs.
local RemoteEvent = game:GetService("ReplicatedStorage").RemoteEvent
local Label = script.Parent
RemoteEvent.OnClientEvent:Connect(function()
Label.Text = "Hello World!"
end)
In the code above is about a hypothetical situation in which you have a RemoteEvent, and you want it so that every time its fired it changes a TextLabel's text to "Hello World!".
To do this, we have a LocalScript located inside of a TextLabel, and whenever the RemoteEvent is fired and the RemoteEvent wants to affect the client then we immediately change the Text to "Hello World!"
We'll have a script in ServerScriptService to fire the RemoteEvent for all of the clients.
game:GetService("ReplicatedStorage").RemoteEvent:FireAllClients()
There's also FireClient() for RemoteEvents that can allow changes for a specific player.
We just need to tweak the code a bit.
game:GetService("ReplicatedStorage").RemoteEvent:FireClient(game.Players.Mr_Unlucky)
Now with this we make it so that a specific player sees that the TextLabel on their screen now says "Hello World!", and this change does not appear for other players.
You can use this knowledge to manipulate trading GUIs and such.
Hope this helped!
2 comments
this is not a script requesting site...
im not requesting, i want someone to explain