my group animation is not playing, even on the same group, the animation priority is also action (i also tried action4 but still didnt work)
here is the full code
local ItemsModule = {}
function ItemsModule.SetupItemPrompts()
local ItemsFolder = workspace:WaitForChild("Items")
for _, displayTool in ipairs(ItemsFolder:GetChildren()) do
if displayTool:IsA("Tool") then
local handle = displayTool:FindFirstChild("Handle")
if not handle then
warn("Tool missing Handle:", displayTool.Name)
continue
end
-- Display tool cannot be picked up
displayTool.Enabled = false
displayTool.CanBeDropped = false
handle.Anchored = true
-- Create PromptPart if missing
local promptPart = displayTool:FindFirstChild("PromptPart")
if not promptPart then
promptPart = Instance.new("Part")
promptPart.Name = "PromptPart"
promptPart.Size = Vector3.new(1, 1, 1)
promptPart.Transparency = 1
promptPart.CanCollide = false
promptPart.CanTouch = false
promptPart.CanQuery = false
promptPart.Anchored = true
promptPart.Parent = displayTool
-- Position PromptPart in front of the handle visually
promptPart.CFrame = handle.CFrame
end
-- Create ProximityPrompt if missing
if not promptPart:FindFirstChild("BuyPrompt") then
local price = displayTool:GetAttribute("Price") or 0
local prompt = Instance.new("ProximityPrompt")
prompt.Name = "BuyPrompt"
prompt.ActionText = "Buy " .. displayTool.Name
prompt.ObjectText = "Price: " .. price
prompt.HoldDuration = 1.5
prompt.RequiresLineOfSight = false
prompt.MaxActivationDistance = 10
prompt.Parent = promptPart
-- BUY LOGIC
prompt.Triggered:Connect(function(player)
local stats = player:FindFirstChild("leaderstats")
if not stats then return end
local money = stats:FindFirstChild("Money")
if not money then return end
if money.Value < price then
return
end
money.Value -= price
-- Clone the DISPLAY tool itself
local newTool = displayTool:Clone()
newTool.Parent = player.Backpack
-- Make purchased tool usable
local newHandle = newTool:FindFirstChild("Handle")
if newHandle then
newHandle.Anchored = false
end
newTool.Enabled = true
-- Play animation on tool.Activated
local animation = newTool:FindFirstChild("Animation") -- or get from ReplicatedStorage
if animation and animation:IsA("Animation") then
local playerChar = player.Character
if playerChar then
local humanoid = playerChar:FindFirstChildOfClass("Humanoid")
if humanoid then
local animator = humanoid:FindFirstChildOfClass("Animator")
if not animator then
animator = Instance.new("Animator")
animator.Parent = humanoid
end
newTool.Activated:Connect(function()
local track = animator:LoadAnimation(animation)
track:Play()
end)
end
end
end
end)
end
end
end
end
return ItemsModule
DETAILS: its a looped animation, R6 posted on the experience’s group, priority Action