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

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

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

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

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