I’m a beginner scripter and I’m trying to make an animation with a ProximityPrompt, I’m not sure why it isn’t working or how to fix it. This is the script:
local Part = proximityPrompt.Parent
local UserInputService = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
proximityPrompt.Triggered:Connect(function(player)
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://8829102602"
local Track = Humanoid:LoadAnimation(Animation)
Track:Play()
end)
proximityPrompt.Triggered:Connect(function(player)
local Animation = Instance.new("Animation")
local PlayerHumanoid = workspace:FindFirstChild(player.Name).Humanoid
Animation.AnimationId = "rbxassetid://8829102602"
if PlayerHumanoid and Animation then --JUST TO MAKE SURE
local Track = PlayerHumanoid:LoadAnimation(Animation)
Track:Play()
else
warn("HUMANOID AND ANIMATION ARE NIL!")
end
end)
local proximityPrompt= script.Parent
local UserInputService = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
proximityPrompt.Triggered:Connect(function(player)
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://8829102602"
local Track = Humanoid:LoadAnimation(Animation)
Track:Play()
end)
First change ur local script to normal script
second put this inside the normal script:
local players = game:GetService("Players").LocalPlayer
local part = script.Parent
part.Triggered:Connect(function(Player)
print("triggerd")
local c = Player.Character
local h = c:WaitForChild("Humanoid")
local ANim = Instance.new("Animation",workspace)
ANim.AnimationId = "rbxassetid://8829102602"
local Track = h:LoadAnimation(ANim)
Track:Play()
end)