-
What do you want to achieve? Keep it simple and clear!
I have a Rig parented to a WorldModel parented to a ViewportFrame. I want to animate the Rig whenever a player hovers their mouse over it. -
What is the issue?
The current code “technically” works but the animation is choppy. -
What solutions have you tried so far?
I’ve tried everything from parenting the local script in various places and as well as changing the rig. I’ve looped the animation in the animation editor and adding AnimTrack.Looped = true still does not fix this issue.
local VPCam = Instance.new("Camera")
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://15502526400"
local ProductFrame = script.Parent
local VPFrame = script.Parent:WaitForChild("ViewportFrame")
local Rig = VPFrame:WaitForChild("WorldModel"):WaitForChild("Rig")
VPFrame.CurrentCamera = VPCam
VPCam.CFrame = CFrame.new(Rig.HumanoidRootPart.Position + Rig.HumanoidRootPart.CFrame.LookVector * 5, Rig.HumanoidRootPart.Position)
local Humanoid = Rig:WaitForChild("Humanoid")
local AnimTrack = Humanoid:LoadAnimation(Animation)
ProductFrame.MouseEnter:Connect(function()
AnimTrack:Play()
end)
ProductFrame.MouseLeave:Connect(function()
AnimTrack:Stop()
end)
Video Proof: