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 comments
But wouldn't you need to use Vector3.new(), define what axis you're changing (X,Y,Z)?
Why would u do this if u want your door sliding?