script.Parent.Touched:Connect(function(hit) if hit.Parent.Humanoid then game.ReplicatedStorage.ShowExitCar:FireClient() end end)
it says fire client: player argument must be a player object
No worries though as I'll teach you today how to use the
Below is an example of how to send an argument to a specific client using a RemoteEvent in a Server Script (See below why.)
Why only in a ServerScript?
The reason we can only have the FireClient event on Server Scripts is to protect a games security as a hacker can easily intercept Local Scripts, and a player could use FireClient to, for example give themselves a very over powered weapon in an FPS for example.
Below I put an example of what your script should look like!
local ExitCar = game.ReplicatedStorage.ShowExitCar script.Parent.Touched:Connect(function(hit) if hit.Parent.Humanoid then local player = game.Players:GetPlayerFromCharacter(Humanoid.Parent) ExitCar:FireClient(player, true) end end)
Let's look at the important lines of the code above!
local player = game.Players:GetPlayerFromCharacter(Humanoid.Parent)
I then fire the event to client by doing
I hope I could help you today and help with your understanding of the
If I wasn't able to solve your issue feel free to contact me on Discord:
Thanks for reading, DrShockz
FireClient ( Player argument) FireAllClients ( tuple) FireServer( tuple ) OnServerEvent(Player argment, tuple) OnClientEvent( tuple )