Hello, I have a script for a car GUI to appear. Except I get Arugment 1 missing or nil? What does that mean???
script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") or ("Mesh")then game.ReplicatedStorage.Right:FireClient() end end)
("Mesh") means nothing you have to write hit.Parent:FindFirstChild("Mesh")
Edit :
Put an argument inside :FireClient() which is the player
If you want to fire it on all player, use :FireAllClients()
FireClient() takes a player as the first argument. That is a REQUIREMENT, or else the server won't know which client it is supposed to be firing to.
You don't want to use the same code block for meshes and the humanoid because otherwise you will sometimes get nil for the player object and it will throw an error.
"Mesh" will always evaluate to true because it is not false or nil so your logic is incorrect, If you are checking if it is a mesh, use Instance:IsA(). If you are checking for something called "Mesh" in hit.Parent, use FindFirstChild a second time. If you are checking for a mesh named anything in hit.Parent, use FindFirstChildOfClass
script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChildOfClass("VehicleSeat") then local char = hit.Parent.Seat.Occupant.Parent if char then game.ReplicatedStorage.Right:FireClient(Players:GetPlayerFromCharacter(hit.Parent)) end end end)