New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How do I get the player that fires an event?

Asked by 11 months ago

I am working on a script where a button will fire an event and a script in serverscriptservice will run a function. I need the script to clone a tool in the player that fired the events backpack.

6
It's automatically the first parameter Vulkarin 580 — 11mo
0
LMFAO ^ greatneil80 1439 — 11mo

1 answer

Log in to vote
2
Answered by 11 months ago

Super easy, when connecting a function to that remote event, it's the first parameter (actually gave me quite a bit of trouble when I first started using them. You can access it like this:

RemoteEvent.OnServerEvent:Connect(function(player) end) Now of course you don't put any parentheses if your function is instantiated before connecting, so put that parameter in the function that is used.

0
You helped me so much thank you ReallyUnikatni 68 — 11mo
Ad

Answer this question