Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I make a smooth sliding door?

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.

5 comments

0

This is my first question, so I will add more detail if anyone needs it.

0

You could try using for loops

0

I did that, but to reopen while it is closing is very hard.

0

lerp?

0

Use TweenService

3 answers

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

5 comments

0

What do you mean by "animation?"

0

Exactly what it says. An animation. Something animating.

0

there is a lot of really useful plugins for animating. use one of them and just animate your door :D

0

Okay! Thanks for your feedback. Sorry I wasn't understanding.

0

Also, what animation plugin is best? I looked but have not found one used for parts. I only found one for handling characters.

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!

1 comment

0

Thanks for responding! I do not understand what you are trying to say... I have spent a while looking at different methods about animations but cannot figure out what you mean. Sorry!

Use animator editor to animate the smooth door closing, then upload it publicly and use it... nothing to do with a script.

3 comments

0

You need the script to trigger the animation, without it nothing will happen.

0

But what type of animation editor should I use? I have searched the plugins menu for quite a while, and have not found a plugin that would work.

0

Use this one here: https://www.roblox.com/library/144373835/Roblox-Animation-Editor you can watch a tutorial on how to use it on youtube.

This discussion is preserved as it was. New answers, comments, and votes are closed.