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

How do I use a Proximity Prompt to play an animation?

Asked by 3 years ago

I'm trying to create a door with a rotating handle that opens using a proximity prompt. While using CFrame/TweenService worked for having an opening door, I couldn't get it to work while having the turning handle, so I resorted to making animations for the door

So far the code have is this:

local prompt = script.Parent.Door

local DoorOpen = Instance.new("Animation")
DoorOpen.AnimationId = "https://www.roblox.com/library/6837516143/hl2-DoorOpen"
local DoorClose = Instance.new("Animation")
DoorClose.AnimationId = "https://www.roblox.com/library/6837521804/hl2-DoorClose"

prompt.Triggered:Connect(function()
    if prompt.ActionText == "Close" then
        DoorOpen:Play()
        prompt.ActionText = "Open"
    else
        DoorOpen:Play()
        prompt.ActionText = "Close"
    end
end)

I am by no means a scripter (most of my attempts of the scripting for this was cobbled together from different YouTube tutorials) so any help you can give would be appreciated

Thanks

2 answers

Log in to vote
0
Answered by 3 years ago

Maybe these people can help you, they are teaching and helping people with Roblox Lua for free. I personally love it: https://discord.gg/MPnhU2aCSb

Ad
Log in to vote
0
Answered by 3 years ago

Animation ids should look like rbxassetid://1234567890, not the URL to the animation's page.

Answer this question