-
What do you want to achieve?
I’d like the proximity prompt to trigger a player animation. -
What is the issue?
The proximity prompt is not triggering the animation. I will include the scripts below& the output! Let me know if you need any more information!
-
What solutions have you tried so far?
I’ve been searching on Reddit & DevForum but haven’t been able to find anything related to the specific issue. I’m also new to coding/scripting and have tried re-writing the code multiple times.
More Information:
Local Script w/in PlayerStarterScripts:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then
character = player.CharacterAdded:Wait()
end
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
-- Create new "Animation" instance
local paintAnimation = Instance.new("Painting")
-- Set its "AnimationId" to the corresponding animation asset ID
paintAnimation.AnimationId = "rbxassetid://9896373997"
-- Load animation onto the animator
local kickAnimationTrack = animator:LoadAnimation(paintAnimation)
Script w/in the part w/ the prox.prompt:
local ProxPromp = script.Parent.ProximityPrompt
local Anim = script:WaitForChild("Painting") -- assuming that your animation is a child of the script
ProxPromp.Triggered:Connect(function (player)-- gets the player
local hum = player.Character:WaitForChild("Humanoid") -- gets the player's humanoid
local animator = hum:WaitForChild("Animator")
local loadAnim = hum:LoadAnimation(Anim) -- loads animation
loadAnim:Play() -- plays the animation
end)
In Output it says this:
Thank you so very much for your help, it’s greatly appreciated