Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How Wold I Make This Remote Slide Door? FIX

Asked by 10 years ago
local IDsOperating = {0}

local Range = 25 


script.Parent.Equipped:connect(function(mouse)
    mouse.Button1Up:connect(function()
        local Ray = Ray.new(script.Parent.Handle.Position, (CFrame.new(script.Parent.Handle.Position, mouse.hit.p).lookVector * Range))
        local Hit = Workspace:FindPartOnRay(Ray, script.Parent.Parent)
        if Hit then
            if Hit:FindFirstChild("RemoteControlledDoor") then
                local DoorID = Hit.RemoteControlledDoor.Value
                for _, v in pairs(IDsOperating) do
                    if v == DoorID then
                        script.Parent.Handle.Beep:Play() 
                        if Hit.CanCollide == true then
                            Hit.CanCollide = true
                            Hit.Transparency = 0 
                        else
                            Hit.CanCollide = true
                            Hit.Transparency = 0 
                        end
                        break
                    end
                end
            end
        end
    end)
end)

Answer this question