I want to make a sliding door for my next hotel on Roblox, and I have found a very smooth sliding door on this game. I am not worried about the design; I just need to know how you can script a smooth motion like that. Plus, it needs to reopen while it is closing (just like in real life).
Can anybody help?
Also, I have done TweenCFrame
before, but when the player walks up to it, it ends up going on top of the player's head if the collision is on.
Hello Pixelated_MC,
You could always use an animation and just run the animation. That could work, but you would need one for open and one for closing. I can't give you the command to run an animation though if you do that, as I don't know what the command is. If you do know it, could you please tell it to me as I am going to use an animation for a game.
Kind Regards, -Nachsor
To do this you can create an animation of the door opening and closing using an animation plugin which you can find on the "Create" page of roblox. You can then use MouseButton1Down to run the animation when clicked on the door like this.
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() Mouse.Button1Down:connect(function() if Mouse.Target.Name == "Name of Door" then local Anim = Instance.new('Animation') Anim.AnimationId = 'rbxassetid://IDNUMBERHERE' local PlayAnim = game.Workspace.Door:LoadAnimation(Anim) PlayAnim:Play() end end)
You can then do the same thing for the closing animation as well.
Hopefully that helps!
Use animator editor to animate the smooth door closing, then upload it publicly and use it... nothing to do with a script.