I am trying to make an animation play after a Proximity Prompt goes off, but it keeps giving me the same error.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DB = false
local proximity = script.Parent
local ChickenModel = ReplicatedStorage.RawChicken
local ChickenSlice = ReplicatedStorage.RawChickenPiece
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ChickenAni = ReplicatedStorage.ChickenAni
--|Animation Variables|--
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local pp = game.Workspace.AniPos
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")
local Cutting = Instance.new("Animation")
Cutting.AnimationId = "rbxassetid://14267037233"
local CuttingTrack = Animator:LoadAnimation(Cutting)
CuttingTrack.Priority = Enum.AnimationPriority.Action
CuttingTrack.Looped = false
proximity.Triggered:Connect(function(Player)
if not DB then
local Chicken = Player.Character:FindFirstChild("RawChicken")
if Chicken then
Chicken:Destroy()
ChickenSlice:Clone()
ChickenSlice.Parent = workspace
ChickenSlice.PrimaryPart = ChickenSlice.Union
ChickenSlice:SetPrimaryPartCFrame(CFrame.new(26.017, 3.265, -34.312))
--Anchor the players model
Player.Character.HumanoidRootPart.Anchored = true
--teleport the player to ontop of pp
Player.Character.HumanoidRootPart.CFrame = pp.CFrame
CuttingTrack:Play()
humanoid.WalkSpeed = 0
CuttingTrack.Stopped:Wait()
humanoid.WalkSpeed = 16
wait(.5)
ChickenAni:FireClient(Player)
DB=true
end
end
end)
I am not a good animator or whatever so Idk whats going on.