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

How to make the door script "Press F?"

Asked by 9 years ago

Please help, just stop viewing it only. You are scripters. Don't be anonymous/unknown.

script.Parent.PrimaryPart = script.Parent.Hinge
hit = false
script.Parent.Parent.Part1.Touched:connect(function()
    if hit == false then
        hit = true
        local i = 0
        while i <= 120 do
            wait()
            script.Parent:SetPrimaryPartCFrame(CFrame.new(script.Parent.Hinge.Position) * CFrame.Angles(0, math.rad(i), 0)) --Rotates Door
            i = i + 5
        end
        wait(3)
        local i = 120
        while i >= 0 do
            wait()
            script.Parent:SetPrimaryPartCFrame(CFrame.new(script.Parent.Hinge.Position) * CFrame.Angles(0, math.rad(i), 0)) --Rotates Door
            i = i - 5
        end
        hit = false
    end
end)
0
If you don't know how to do something, search it on the wiki or use the search bar of this website. That will then link you to questions that are related to what you're after so you can then implement that into your own script Uroxus 350 — 9y
0
Well, the thing is. I get confused a lot with Lua although I'm a medium-scripter. >_> ShinoKae 0 — 9y

1 answer

Log in to vote
2
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

The reason several other scriptures are only viewing it, is because you haven't shown any attempts to do it yourself. This isn't constructive, since you're asking us to create a portion of the script for you. I'll give you a few tips:

I'm supposing you want it when someone Presses F, it opens. To do that, remove line 3, and use the KeyDown event. To use that, you'll have to use game.Players.LocalPlayer:GetMouse() to retrieve the mouse. Note: To use this, it'll need to be a LocalScript within the Player, such as the Player object itself, PlayerGui, or the Backpack.

Once you add in the KeyDown event (Search wiki.roblox.com for it), you'll ned a new debounce. Preferably a value inside of the Hinge itself. A BoolValue that tells if it's open or closed. Also, you'll need another BoolValue to see if another player is already opening/closing it.

That's about as much help as I can give you at this point, so good luck!

0
so KeyDown and GetMouse are the same "Body"? darkzerobits 92 — 6y
0
You're asking quite late. KeyDown is deprecated, and I'm not sure what you mean by Body Shawnyg 4330 — 6y
Ad

Answer this question