I have an error in my code that only happens in game, not in any form of studio. I don't think it's breaking the shop. Error: FireClient: player argument must be a Player object

LocalScript:

guiRemote.OnClientEvent:connect(function(player)
	print(player)
	tweenEffects()
end)

Script:

local guiEvent = game:GetService("ReplicatedStorage"):WaitForChild("Remotes"):WaitForChild("GuiEvent")
script.Parent.Touched:connect(function(hit)
	guiEvent:FireClient(game.Players:GetPlayerFromCharacter(hit.Parent)) --Error
end)

The error is on line 3 of the script.

1 comment

1

Make sure you check if its a player character and the first arg of OnClientEvent doesn't return the player