So I made a script where the tiles disappear and disable can collide after the touch event gets triggered by the client touching it. The script went fine for the first tile to be touched but after the first one, it takes a long time for it to disappear and disable can collide after it's being touched.
local tiles = game.Workspace.Tiles:GetChildren()
local debounce = true
for i, v in pairs(tiles) do
v.Touched:Connect(function(hit)
local player = game.Workspace:FindFirstChild(hit.Parent.Name)
print(player)
if player then
if debounce == true then
debounce = false
v.Transparency = 0.5
wait(1)
v.Transparency = 1
v.CanCollide = false
wait(3)
v.Transparency = 0
v.CanCollide = true
debounce = true
end
end
end)
end
