This is where remote events come in.
Start by inserting a Remote Event into ReplicatedStorage. Now, you use :FireClient() and .OnServerEvent. (If you're tying a Server Script TO a LocalScript, use :FireClient() and OnClientEvent. If you're tying a Local Script, to a Server Script, use :FireServer() and OnServerEvent.)
To do this, say this was you're regular script (Make sure its somewhere that can run Server Scripts):
game.Players.PlayerAdded:Connect(function(player)
print("Test")
game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent"):FireClient(player)
end)
Now what you do, is you make your local script listen for that Fire. And when it hears it, it will do what you want the Local Script to do (Make Sure its somewhere that can run LocalScripts).
game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent").OnClientEvent:Connect(function()
end)
Any questions leave down below and ill answer em, make sure to accept if I helped :)
1 comment
Remote events