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