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

how to fireclient from object to player with a parameter?

Asked by 4 years ago

Im trying to make it where if a player clicks on an object, it will fireclient to the player along with a parameter but i cant figure out how to do it or pick it up in the players local script. I know how to do it the opposite way but nowhere online does it give the exact code.

1 answer

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
4 years ago

Read up on this tutorial.

Server -> Client

Event:FireClient(Player, Object) -- Player is a required first argument, anything else is optional
---- Below is receiving an event on the client. Client Script
Event.OnClientEvent:Connect(function(Object)
    print(Object.Name)
end)

Client -> Server

Event:FireServer(Object)

-- Below is receiving an event on the server. Server Script

Event.OnServerEvent:Connect(function(Player, Object) -- Player is required if you're using additional arguments
    print(Object.Name)
end
Ad

Answer this question