I am trying to make a platform that checks if multiple players are touching at the same time. What is the simplest way to do that? This is pretty much all I have l:
platform.Touched:connect(function(hit) local player = hit.Parent if player.Character:FindFirstChild("RobberMatchTag") then local robber = player end end)
All you would need to do, is something like this:
Touching={} platform.Touched:connect(function(hit) local Valid=true local player = hit.Parent if player.Character:FindFirstChild("RobberMatchTag") then local robber = player for i=1, #Touching do if Touching[i]==robber then --Checks if players already touching Valid=false end end if Valid==true then Touching[#Touching+1]=robber end end end) platform.TouchEnded:connect(function(hit) --removes players from table when they stop touching local player = hit.Parent if player.Character:FindFirstChild("RobberMatchTag") then local robber = player for i=1, #Touching do if Touching[i]==robber then Touching[i]:remove() end end end)
I think this should work. If you have any problems please leave a comment below. Hope I helped :P