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

How can I send a Server script to work on a client server?

Asked by 5 years ago

I don't under stand how i could get a server script and get it to work in a client server. Can anyone give me a little bit more information on this?

0
can you rephrase this question green271 635 — 5y

1 answer

Log in to vote
0
Answered by
Lugical 425 Moderation Voter
5 years ago

Note: Could you try to rephrase your question? My answer is based on what I believe you're trying to say.

Anyways, from what I'm interpreting, you are wondering how to get a ServerScript's features (i.e Functions, Statements, etc.) to show to the clients. With this, you can use RemoteEvents to display information from the Server to the Client. Here's a little example: Main Script

if 1 + 1  == 2 then
game.ReplicatedStorage.RemoteEvent:FireAllClients()
end

LocalScript

game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function()
    print("hi!")
end)

What I did was comunicate to all the clients by firing the RemoteEvent. Upon firing, the clients receive the message, and end up printing "hi!" into the Client's output. You could also replace this with FireClient(). Hopefully this helps, and I'm sorry if I misunderstood your question!

0
One more thing, do i need to put the FireAllClients/FireClient in a function? GGButNO_RE 61 — 5y
0
It's not required but, you can if you want the script to play at a certain event or so. Lugical 425 — 5y
Ad

Answer this question