I’ve tried tweening the HRP to go along with the animation, so it moves somewhere. The problem is that when I try to do a high dive, the camera violently shakes, as if the HumanoidRootPart (seeing as the camera target is the HRP) is colliding against something and simulating unwanted physics. Maybe it’s something in the script? I dunno. I’ve checked the character hierarchy and have found nothing, and I have nothing else welded to my character that might cause those problems.
game:GetService("UserInputService").InputBegan:Connect(function(input, gameprocess)
if (not gameprocess) then
if backpack.IsTackled.Value == true then return end
if switch.Value == "Goalkeeper" then
if react == true then return end
if debounce == true then return end
if count == 1 then return end
if holdingBall.Value == true then return end
if input.KeyCode == Enum.KeyCode.Q then
debounce = true
react = true
sprintDisabled.Value = true
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
local animtrack = humanoid:LoadAnimation(anims.ZDive)
animtrack.Priority = Enum.AnimationPriority.Action
animtrack:Play()
animtrack:AdjustSpeed(2)
local TweenService = game:GetService("TweenService")
local Info = TweenInfo.new(1.05, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local Tween = TweenService:Create(HRP, Info, {
CFrame = HRP.CFrame * CFrame.new(-10, 5, 0)
})
Tween:Play()
wait(1)
react = false
humanoid.WalkSpeed = 14
humanoid.JumpPower = 50
sprintDisabled.Value = false
wait(0.4)
debounce = false
end
end
end
end)
Alright, I’ve tried that solution. However, a new problem occurs. After the tween finishes, I can move normally, but if I jump and try to move in another direction, it’ll go somewhere else.
No, it behaves strangely. If I for example try to jump and press W, the character feels like it’s being pushed in another direction and doesn’t do what it’s instructed to do.
Does that new problem occur if you were to run the game without my prior solution?
(The most likely culprit would be a heavy part or force attached to the character, but I’m ruling that out for now since you’ve stated that you’ve checked the character for welds or oddities during runtime.)
It seems you’re trying to do a goalkeeper dive in soccer? I don’t recommend using TweenService as it’s meant for visual effects more than gameplay actions.
BodyVelocity should work fine here for the dive motion.
There’s one thing I’m confused about though, how do you make the velocity relative to the character? If it’s facing forward, back, or left, I always want it to move to the left of the character, for example. How do I do that? I’ve tried using lookvector * the vector3, but to no avail.
No, I mean like, since the velocity is a set value, how do I make it so it moves left relative to the character’s orientation, instead of the world space?
You should not be using a vector to apply power, just a number. RightVector isn’t in object space, rather it’s a unit vector that describes a direction.