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

How to make a click to open door?

ive looked online but i havnt found one i like. all of them are slide doors and i want to make one where it opens like a real door. not the animation but ust opens and closes like a real door. basically, like this: https://gyazo.com/7acdf75759f69aa126a4f44c0a206c98 https://gyazo.com/4dd407dac34834083311469c414b5e89 i need this for my game i plan on making. i wanna make it by myself but i have no idea where to start. thanks.

6 comments

0

If you have no idea where to start i suggest looking at the wiki. http://wiki.roblox.com/

0

@RubenKan i know how to script, i ust dont have any idea where to start with this door

0

Do you want the door to swing open or just like have someone be able to walk through it? If you want just to walk through it, I'll put how to down below.

0

@Inpolite Swing open, but thanks i guess

0

OH MY BAD SORRY LOLOL U SAID CLICK I PUT TOUCH AM SO SORRY

0

well hmm... i guess you would set the rotation of the object. here, i'll edit my script.

1 answer

✓ Accepted answer
--Touch script
local door = game.Workspace.Door --[[ This is to find the door in workspace. just make a wooden part that's brown and put this script in workspace or inside the door if you'd like.--]]
door.Touched:connect(function(hit)
	if hit.Parent and hit.Parent.Humanoid and hit.Parent.Humanoid > 0 and hit.Parent.Character then
		door.CanCollide = true
		--door.Transparency = 0.5
			wait(2.5)
		door.CanCollide = false
		--door.Transparency = 0
end)

By EvIlBrAinBug. I'm using my alt for my scripting helpers acc.

remove all the little dashes for the transparency parts if you want it to go transparent when you touch it.

--click script

local clicker = Instance.new("ClickDetector")
local door = game.Workspace.Door
clicker.Parent = door
door.ClickDetector.MouseClick:connect(function()
	door.Rotation(#, #, #)-- use the rotate tool and put the numbers here
	wait(5)--how long it stays open(you can change time if you want doesn't matter to me)
	door.Rotation(#, #, #)--put the numbers of it's original rotation position numbers
end)

Sorry for getting confused for a second but ill just keep the touch script so you can keep it for future reference.

9 comments

0

@Inpolite "Workspace.Door.Script:5: attempt to call field 'Rotation' (a userdata value)" is the error I ran into. any idea why it did this and how to fix it?

0

i fixed it. but as soon as a i click it, it disappears. any idea hoe to stop this? if you figure out a way, ill accept the answer

0

Use rotate tool and find the rotation u like then paste it into the thing. then also put door.Position(#, #, #,) below the door.Rotation. Do the same for the one after wait also with door.position(#,#,#) sorry for forgetting to inform u. u only set rotation but we dont know where to rotate it and put the door

0

It teleports into the ground, what to do now?

0

@Inpolite still isn't working. could you help me?

0

well, to make it perfectly swing i'd have to add weld scripts and cframe and everything like not just teleport. i did it for you so uhhh here: https://www.roblox.com/item.aspx?id=600025639

0

Doing this kind of thing perfectly isn't difficult it's just tedious to make it move like that. but i did it for u <3 lol

0

@Inpolite thanks, really appreciate it!

0

Your welcome! It was a pleasure and a great experience helping you.

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