~~~~~~~~~~~~~~~~~
local Part = script.Parent
local EndParts = {game.Workspace.TEndPart, game.Workspace.DEndPart, game.Workspace.Neon1EndPart, game.Workspace.DessertEndPart, game.Workspace.ASHEndPart}
Part.Touched:Connect(function() for _, object in pairs (EndParts) do object.Transparency = 1 object.CanCollide = false wait(60) object.Transparency = 0 object.CanCollide = true end end) ~~~~~~~~~~~~~~~~~~
I'm confused to why it's not working at all, help would be appreciated
Hello. The problem is that you have a wait(60)
in the loop meaning it'll have to wait one minute before going on to the next part, meaning that it would take five minutes for the part to turn invisible. Instead, make a separate loop that makes the EndParts visible again with a wait in between the two loops. Try this:
local Part = script.Parent local EndParts = {game.Workspace.TEndPart, game.Workspace.DEndPart, game.Workspace.Neon1EndPart, game.Workspace.DessertEndPart, game.Workspace.ASHEndPart} Part.Touched:Connect(function() for _, object in pairs(EndParts) do object.Transparency = 1 object.CanCollide = false end wait(60) for _, object in pairs(EndParts) do object.Transparency = 0 object.CanCollide = true end end)
If you want it to happen when a humanoid/player touches it, do this:
local Part = script.Parent local EndParts = {game.Workspace.TEndPart, game.Workspace.DEndPart, game.Workspace.Neon1EndPart, game.Workspace.DessertEndPart, game.Workspace.ASHEndPart} Part.Touched:Connect(function(otherPart) if otherPart.Parent:FindFirstChildOfClass("Humanoid") then for _, object in pairs(EndParts) do object.Transparency = 1 object.CanCollide = false end wait(60) for _, object in pairs(EndParts) do object.Transparency = 0 object.CanCollide = true end end end)
When the part is touches, it'll check for a humanoid. If it has one, it'll continue the script.
Please accept and upvote this answer if it helped you.
I'm guessing u want it to be on touched, so it would be
Part.Touched:Connect(function(touched)
I'm not sure if it works but give it a go and see what happens, if it not works then i wish u a good day and good luck.