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

How can I prevent my door from sinking into the ground when the script runs?

Asked by 5 years ago

Okay, I'm posting this here again. I know it's messy I don't need the feedback on my organizational skills or whatever my issue is, unless it's actually going to help me. I don't understand how to prevent my door from sinking into the ground after CanCollide = false while using two parts. If there are any people who want to take some time and help me out I would greatly appreciate it. Thank you so much! :)

local Frame1 = script.Parent.Parent.Door1.Frame
local Glass1 = script.Parent.Parent.Door1.Glass
local Frame2 = script.Parent.Parent.Door2.Frame
local Glass2 = script.Parent.Parent.Door2.Glass
local Frame1O = script.Parent.Parent.Door1OBJ.Frame
local Glass1O = script.Parent.Parent.Door1OBJ.Glass
local Frame2O = script.Parent.Parent.Door2OBJ.Frame
local Glass2O = script.Parent.Parent.Door2OBJ.Glass
local Frame1O2 = script.Parent.Parent.Door1OBJ2.Frame
local Glass1O2 = script.Parent.Parent.Door1OBJ2.Glass
local Button = script.Parent

Button.Touched:Connect(function(partTouched)
    local bFrame1 = Instance.new("BodyPosition",Frame1)
    bFrame1.MaxForce = Vector3.new(7000,99999999999,7000)
    local bGlass1 = Instance.new("BodyPosition",Glass1)
    Frame1.Anchored = false
    bFrame1.Position = Frame1O.Position
    Frame1.CanCollide = false
    Glass1.Anchored = false
    bGlass1.Position = Glass1O.Position
    Glass1.CanCollide = true
    wait(2.3)
    Frame1.Anchored = true
    Frame1.CanCollide = true
    Glass1.Anchored = true
    Glass1.CanCollide = true
    wait(4)
    Frame1.Anchored = false
    bFrame1.Position = Frame1O2.Position
    Frame1.CanCollide = false
    Glass1.Anchored = false
    bGlass1.Position = Glass1O2.Position
    Glass1.CanCollide = false
    wait(2.3)
    Frame1.Anchored = true
    Frame1.CanCollide = true
    Glass1.Anchored = true
    Glass1.CanCollide = true
end)

0
If you have anchored and can collide false, the door is guaranteed to sink into the ground. I would try to keep it anchored, or if you are using body force, try to make it so that it is in a collision group with the ground but not the players. (so they can walk through) greenhamster1 180 — 5y

Answer this question