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

How to make a click to open door?

Asked by 8 years ago

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.

0
If you have no idea where to start i suggest looking at the wiki. http://wiki.roblox.com/ RubenKan 3615 — 8y
0
@RubenKan i know how to script, i ust dont have any idea where to start with this door Leanoholic 2 — 8y
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. Inpolite 44 — 8y
0
@Inpolite Swing open, but thanks i guess Leanoholic 2 — 8y
View all comments (2 more)
0
OH MY BAD SORRY LOLOL U SAID CLICK I PUT TOUCH AM SO SORRY Inpolite 44 — 8y
0
well hmm... i guess you would set the rotation of the object. here, i'll edit my script. Inpolite 44 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago
--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.

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? Leanoholic 2 — 8y
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 Leanoholic 2 — 8y
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 Inpolite 44 — 8y
0
It teleports into the ground, what to do now? Leanoholic 2 — 8y
View all comments (5 more)
0
@Inpolite still isn't working. could you help me? Leanoholic 2 — 8y
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 Inpolite 44 — 8y
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 Inpolite 44 — 8y
0
@Inpolite thanks, really appreciate it! Leanoholic 2 — 8y
0
Your welcome! It was a pleasure and a great experience helping you. Inpolite 44 — 8y
Ad

Answer this question