I have a script that requires the player to play an animation while the proximity prompt has its PromptButtonHoldBegan event triggered and stop the said animation when PrompButtonHoldEnded event is triggered.
The issue is that it plays the animation when the PromptButtonHoldBegan event is triggered but it does not stop upon the PromptButtonHoldEnded event being triggered.
And yes, I have tried to use forum posts to solve my issue but it had no success.
Here’s the script:
local prox = script.Parent
prox.PromptButtonHoldBegan:Connect(function(plr)
local hum = plr.Character.Humanoid
local anim = hum:LoadAnimation(script.Animation)
anim:Play()
hum.Parent.HumanoidRootPart.Anchored = true
end)
prox.PromptButtonHoldEnded:Connect(function(plr)
local hum = plr.Character.Humanoid
local anim = hum:LoadAnimation(script.Animation)
anim:Stop()
hum.Parent.HumanoidRootPart.Anchored = false
end)
Any sort of help is greatly appreciated