Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

FireClient: player argument must be a Player object | Truck connect to Trailer Script?

Asked by 5 years ago

Creating a Script that Connects a Trailer with a Truck via a BallSocketConnector. Built around the A-Chassis.

How it should work: GUI Red. Truck has a Hitbox. Trailer hitch touches Hitbox. GUI Yellow. Player clicks "Attach" on GUI. GUI Turns Green BallSocketConnector attaches to Truck. Truck and Trailer Drives off.

What actually happens: GUI Red. Truck Hitbox touches Trailer Hitch Output prints: FireClient: player argument must be a Player object

Code:

local trailer
local stop = false
local stop1 = false 
script.Parent.TouchPart.Touched:connect(function(part)
    if not stop then
        stop = true
        if part.Name == "Attach" then
            trailer = part.Parent.Parent
            script.Parent.RemoteEvent:FireClient(game.Players:GetPlayerFromCharacter(script.Parent.Parent.Parent.Parent),"GoodToGo",part.Parent.Parent)
        end
    end
    stop = false
end)

script.Parent.TouchPart.TouchEnded:connect(function(part)
    if not stop1 then
        stop1 = true
        if part.Name == "Attach" then
            wait(1)
            script.Parent.RemoteEvent:FireClient(game.Players:GetPlayerFromCharacter(script.Parent.Parent.Parent.Parent),"NoGood",part.Parent.Parent)
        end
    end
    stop1 = false
end)

Lines of code which has the problem:

script.Parent.RemoteEvent:FireClient(game.Players:GetPlayerFromCharacter(script.Parent.Parent.Parent.Parent),"GoodToGo",part.Parent.Parent)

Second:

script.Parent.RemoteEvent:FireClient(game.Players:GetPlayerFromCharacter(script.Parent.Parent.Parent.Parent),"NoGood",part.Parent.Parent)

I would appreciate any assistance.

Thanks, Bradolink.

Answer this question