I’m trying to play a dribbling animation when my player touches a ball. It works fine, but my dribbling animation is mixing with the default walking animation. I already tried setting the priority of my animation to action, but it did nothing.
local Players = game:GetService("Players")
local Wspace = game.Workspace
local Rstorge = game.ReplicatedStorage
local character = script.Parent
local humanoid = character:FindFirstChild("Humanoid")
local dribbling = Rstorge.dribbling
local dribbleTrack = humanoid:LoadAnimation(dribbling)
print("dribbling anim loaded")
dribbleTrack.Looped = true
dribbleTrack:AdjustWeight()
local player = Players:GetPlayerFromCharacter(character)
local hitbox = game.ReplicatedStorage.hitbox:Clone()
local balls = Wspace.balls
--attach the hitbox to urself--
hitbox.Parent = character
local weld = Instance.new("Weld")
weld.Parent = character
weld.Part0 = hitbox
weld.Part1 = character.HumanoidRootPart
hitbox.Position = character.HumanoidRootPart.Position
weld.C0 = CFrame.new(0,2.5,2.5)
local mouse = player:GetMouse()
mouse.Button1Down:Connect(function()
print("click")
local objects = Wspace:GetPartsInPart(hitbox) --when the player clicks, this is all the objects the hitbox is touching--
for i=1, #objects do
if objects[i].parent == balls then
print("you have the ball")
local ball = objects[i]
ball.Parent = character
local connection = Instance.new("Motor6D")
connection.Parent = ball
connection.Part0 = character.HumanoidRootPart
connection.Part1 = ball
dribbleTrack:Play()
break
end
end
end)
The script connects the ball and plays the animation and everything, but the animation blends in with the normal walk and idle animation
do i have to set the run and walk animations weight to 0 or something so they dont blend?
My animation is set to action so it should work. Thats what got me confused
I tried setting the weight but nothing seemed to happen. Check out this video robloxapp-20240714-1449320.wmv (1.8 MB)
The animation works fine when I’m not moving, but when I start to move, my guy starts doing the griddy or something. How do I get the animation to play without doing all that extra stuff?
Just tried that. It didn’t change anything, but I tried deleting the animate script from my character in game, and that did the job. The only problem is that that script needs to work while the character doesn’t have the ball. Im gonna try momentarily disabling it and seeing if that will work.
Disabling the script doesn’t work, but even if it does, I know somethings gotta be off because shouldn’t my animation just be able to play if the priority is higher than Roblox’s animations? Is there something wrong with the script above? I really need this animation to work and I’m stuck right now.
Also, Im sorta lost with this animate script. I read there was some sort of update about animation blending but the last time i tried to use studio was years ago so im kind of lost right now. I tried to change the animations weight in this part (line 44-49). It used to be 10 or something but i changed it to 0 and nothing changed:
walk = {
{ id = "http://www.roblox.com/asset/?id=507777826", weight = 0 }
},
run = {
{ id = "http://www.roblox.com/asset/?id=507767714", weight = 0 }
},
alright this is weird. I tried playing the animation I made in a new baseplate and now it doesn’t play at all. What could I be doing wrong? The animation is mine and i set it up the exact same way as before.
I did try replacing the walking animation with mine and it played, but that won’t work for me because I only want them doing that animation when they have the ball
but you have custom jump animations when a player has a ball yeah? Like they grab it n shoot it or something. and I would assume the idle is just dribbling yeah?
Also I noticed when you mentioned how you were changing the animation priority did u do it from the animation menu?
I did it from both, the script and the menu, but it still didn’t work.
I heard someone say that I may have to put all the bodyparts in my animation in a keyframe, even if they don’t move, so they don’t get influenced by default animations, so im gonna try that.
just figured it out! It was just that I didn’t have a keyframe in each body part, so the default animations still moved those parts regardless of if the priority was higher.