I'm making a survival game and I need to get it so when you chop down a tree you gain specific resources. I have everything done, except what you're supposed to fire it to. I need the event to fire the Client from the Server but don't know what to put in the parenthesis after "event:FireClient(?)". What do I need to do? I try things like "Player", or "Touched.Parent" or "Player.Name" but then it gives me any of these errors: "Unable to cast value to object", or "Argument must be a player object". Please help me :/
COMMUNITY QUESTION
What do I fire a remoteEvent to?
1 answer
event:FireClient(parameters)
You will need to make LocalScript and insert function event.OnClientEvent(parameters)
Parameters: you can use LocalPlayer or any parameter, but you will need to do the same for ServerScript. For example:
ServerScript:
-- The code I gave you in previous question or use your own
event:FireClient(player) -- You must connect to a function and insert event:FireClient() into the function. Make sure you add player if possible in the function as a parameter.
LocalScript:
-- Also use same code
function onClientEvent(player)
-- do stuff
end
event.OnClientEvent:Connect(onClientEvent)
That was one example. You can search up RemoteEvent:FireClient() on Google and read more about it. Hope this helps!
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
When I do this, it yells at me that the parameter must by a player object, and when I put something else like player.Character of player.Name or whatever, it just says "Attempt to index nil with 'Character/Name'"
for player.Character use player.CharacterAdded:Wait() or something