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

Proximity prompt plays animation on part?

Asked by 2 years ago

I have a fbx model that I animated, and I want the animation to play when you proximity prompt click it.

How do I do this?

1 answer

Log in to vote
0
Answered by
NykoVania 231 Moderation Voter
2 years ago

This should work.

local ProximityPromptService = game:GetService("ProximityPromptService")
local Animation Location = where your animation is located

local function onPromptTriggered(promptObject, player)
    player.Character.Humanoid:LoadAnimation(AnimimationLocation):Play()
end

ProximityPromptService.PromptTriggered:Connect(onPromptTriggered)

Ad

Answer this question