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

Door hangs how to make it open smoothly?

Asked by 8 years ago
Edited 8 years ago

I can create a door but as it opens it just hangs and u need to push it that it goes up again like the script is working but the door is moving for some secs and then stops only at the 2nd time it gets opened.

The script works still but the question is: How do I create a door that moves smooth and does NOT hang and CanCollide = true. If someone knows how to a BIG thx will be spoken!

local door = script.Parent.Parent:WaitForChild("Door")
local bodv = door:WaitForChild("BodyVelocity")
local Open = Instance.new("Sound", door)
Open.SoundId = "rbxassetid://130794579"
local Close = Instance.new("Sound", door)
Close.SoundId = "rbxassetid://130794614"

script.Parent.Touched:connect(function(hit)
    if hit ~= nil then
        if hit.Parent ~= nil then
            if hit.Parent:FindFirstChild("Humanoid") then
                if hit.Parent:FindFirstChild("Head") then
                    if hit.Parent.Humanoid.Health > 0 then
                        if game.Players:GetPlayerFromCharacter(hit.Parent) then
                            local debounce = script.Parent.Parent.debounce.Value
                            if not debounce then
                                script.Parent.Parent.debounce.Value = true
                                door.Anchored = false
                                bodv.Velocity = Vector3.new(0,4,0)
                                Open:Play()
                                wait(6)
                                bodv.Velocity = Vector3.new(0,-4,0)
                                Close:Play()
                                wait(6)
                                bodv.Velocity = Vector3.new(0,0,0)
                                door.Anchored = true
                                wait(2)
                                script.Parent.Parent.debounce.Value = false
                            end
                        end
                    end
                end
            end
        end
    end
end)

2 answers

Log in to vote
0
Answered by 8 years ago

Why are you adding all these if statements you don't even need the if statement for the health

And what i recommend doing is doing a for loop for rotation. So something like this

for i = 0, 100, 1 do
    wait(0.1)
    script.Parent.Rotation = i
end

1) it'll look veryyy smooth 2) it's efficient

0
But wouldn't you need to use Vector3.new(), define what axis you're changing (X,Y,Z)? TheHospitalDev 1134 — 8y
0
Why would u do this if u want your door sliding? RicheeNektar 78 — 8y
Ad
Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

**Ugh? Maybe provide the script you're using **

Have a read of this document

0
Nau I added the "Script" ur happy now? lol RicheeNektar 78 — 8y

Answer this question