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
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
: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.
####See the RemoteEvent:FireClient Documenation for a greater understanding.
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)
ExitCar:FireClient(player, true)
The true depends on what the arguments are in your LocalScript, but in this example I use to to signify that the player exits the vehicle is equal to 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
when you discover headers in scriptinghelpers, also good answer i like
idk
answers are not advertisements
LOOOOOOOOOOOOOOL I CANT
FireClient ( Player argument) FireAllClients ( tuple) FireServer( tuple ) OnServerEvent(Player argment, tuple) OnClientEvent( tuple )
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
hmmm
idk, make sure that the object is a player. not just a humanoid.
got the answer fireclient must have a player argument so it is send to the player
game.ReplicatedStorage.ShowExitCar:FireClient(game.Players:FindFirstChild(hit.Parent.Name))