I have this script but it does not play animation.(but prints successful)
Ive tried binding local script to the same pprompt but it didnt work either.
Is tgere any way to fix this? I need to keep a normal script too as it includes some functions l neeed (such as changing object properities etc)… help please
function ButtonClicked(Player)
route.Button.ProximityPrompt.Enabled = false
local shockAnimation = script.Animation
shockAnimation.AnimationId = "http://www.roblox.com/asset/?id=11531168774"
local char = Player.Character or Player.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
local loadanim = humanoid:LoadAnimation(shockAnimation)
print("successful")
end
workspace.Button.ProximityPrompt.Triggered:Connect(ButtonClicked)
This will play the animation. Right now, you’ve just loaded it and nothing else.
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://11531168774"
workspace.Button.ProximityPrompt.Triggered:Connect(function(player)
route.Button.ProximityPrompt.Enabled = false
local track = player.Character.Humanoid.Animator:LoadAnimation(anim)
track:Play()
-- Did you want to reenable the prompt later?
end)