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

[SOLVED] Why am I getting a 'player argument must be a Player Object' Error?

Asked by 5 years ago
Edited 5 years ago

The error I get is 'player argument must be a Player Object'.

I'm pretty sure it is a player object, but the script says it isn't any help would be nice.

local inorout

script.Parent.Touched:Connect(function(hit)
    inorout = "In"
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    game.ReplicatedStorage.UpgradeOpenEvent:FireClient(player, inorout)
end)

script.Parent.TouchEnded:Connect(function(hit)
    inorout = "Out"
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    game.ReplicatedStorage.UpgradeOpenEvent:FireClient(player, inorout)
end)
0
OOF. I forgot to check if the touch is a humanoid. kittonlover101 201 — 5y

Answer this question