So I’ve got an elevator that works by using GetTouchingParts, except it doesn’t work. I don’t know exactly what part is broken, or how to fix it. All help is appreciated!
game.Workspace.Part1.Touched:Connect(function() end)
game.Workspace.Part2.Touched:Connect(function() end)
local floor = 1
script.Parent.ClickDetector.MouseClick:Connect(function()
if floor == 1 then
floor = 2
game.Workspace.SignalPart1.BrickColor = BrickColor.new("Persimmon")
game.Workspace.SignalPart2.BrickColor = BrickColor.new("Bright green")
local parts = game.Workspace.Part1:GetTouchingParts()
for _, part in next, parts do
if part.Parent:FindFirstChild("Humanoid") then
part.Parent.HumanoidRootPart.CFrame = game.Workspace.Part2.CFrame
end
end
end
if floor == 2 then
floor = 1
game.Workspace.SignalPart1.BrickColor = BrickColor.new("Bright green")
game.Workspace.SignalPart2.BrickColor = BrickColor.new("Persimmon")
local parts = game.Workspace.Part2:GetTouchingParts()
for _, part in next, parts do
if part.Parent:FindFirstChild("Humanoid") then
part.Parent.HumanoidRootPart.CFrame = game.Workspace.Part1.CFrame
end
end
end
end)
```.