✓ Accepted answer
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.
1 comment
Is the Part anchored?