Check player touching part not working

so i took the script in foreum, a realized that it has an error, so.i modified it, but on the touch ended part I need to say what hit was, so I put it in the function name like this:

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local lava = ReplicatedStorage:WaitForChild("Lava")

local Players = game.Players:GetPlayers()
local Pog = game.Workspace:WaitForChild("Pog")
local PlayersTouchingPart = {}
Pog.Touched:Connect(function(hit)
	local Player = Players:GetPlayerFromCharacter(hit.Parent)
	if Player and not table.find(PlayersTouchingPart ,Player.Name) then 
		table.insert(PlayersTouchingPart, Player.Name)
	end
end)

Pog.TouchEnded:Connect(function()
	local Player = Players:GetPlayerFromCharacter(hit.Parent)
	if Player and table.find(PlayersTouchingPart ,Player.Name) then
		table.remove(PlayersTouchingPart, table.find(PlayersTouchingPart, Player.Name))
	end
end)

print(#PlayersTouchingPart)

and there was a lot of errors about line 16

1 Like

Line 16 is giving you an error because there is no parameters with hit in the endtouch event

no i added the (hit) and it got the error, it has an orange line without it

thats the end off that code, u made new event means u need hit in them 2 (hit) as I said it’s new event u started because u already made new event and new links off code

so how do i fix it? do i delete the hit?

oh and heres the oringinal thing i got it from