FireClient: player argument must be a Player object even though I referenced the player already

I’m currently making a system where if a player touches a part, a gui shows on their screen. This is my code:

local Brick = script.Parent
local shopGuiRemoteEvent = game.ReplicatedStorage.ShowShopGui

local Players = game:GetService('Players')
--End--

--Code--
local function PlayerTouched(player,Part)
	print('touched')
	shopGuiRemoteEvent:FireClient(player)
	print('fired')
end

Brick.Touched:Connect(PlayerTouched)

It comes up with this error:

FireClient: player argument must be a Player object

Even though I already specified the player argument here.

local function PlayerTouched(player,Part)
	print('touched')
	shopGuiRemoteEvent:FireClient(player)
	print('fired')
end

Why is this happening?

Brick.Touched doesn’t return the player. It only returns the part that came in contact with the brick. You will have to somehow get the player from the part, and then pass that into :FireClient as the player parameter.

If I remember correctly, .Touched returns the part of which touched it, I forgot the function name, but there’s a way to get a player object from one of their parts

The function was game.Players:GetPlayerFromCharacter(character). character should be the player’s character model.