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
Hello,
:FireClient()
event!No worries though as I'll teach you today how to use the :FireClient()
event!
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)
ExitCar:FireClient(player, true)
I then fire the event to client by doing
ExitCar:FireClient(player, true)
I hope I could help you today and help with your understanding of the :FireClient()
event!
If I wasn't able to solve your issue feel free to contact me on Discord: DrShockz#0246
Thanks for reading, DrShockz
https://scriptinghelpers.org/questions/124217/how-can-i-make-a-view-model-to-be-visible-when-i-use-the-tool
FireClient ( Player argument) FireAllClients ( tuple) FireServer( tuple ) OnServerEvent(Player argment, tuple) OnClientEvent( tuple )