Verify when a bone has a certain rotation

Hey guys, I’ve been trying to find a way to code obstacles for an obstacle course using animations, but since Roblox’s collisions doesn’t follow animations I had to think for alternatives.

So I’m trying to determine the exact moment a bone has a certain rotation, but i’m a real code Noob and I guess that what I’m trying to do isn’t that simple. Here’s my code :

if bone.CFrame.Rotation == Vector3.new(0, 0, 55.919) then
	print ("NOW !")
end

any ideas ?

Are you playing an animation?

1 Like

yes, this is just a part of the whole code, but the animation is playing

‘’'lua
local bone = script.Parent[“Cylinder.002”].Bone

wait(5)

local rig = script.Parent

– Create a new “Animation” instance and assign an animation asset ID
local SlamAnimation = Instance.new(“Animation”)
SlamAnimation.AnimationId = “rbxassetid://18608603693”

– Create a new “AnimationController” and “Animator”
local animationController = Instance.new(“AnimationController”)
animationController.Parent = rig

local animator = Instance.new(“Animator”)
animator.Parent = animationController

– Load the animation onto the animator
local slamAnimationTrack = animator:LoadAnimation(SlamAnimation)

– Play the animation track
slamAnimationTrack:Play()
‘’’

you can use GetMarkerReachedSignal instead

1 Like

Oh my god this is exactly what i’m looking for, thanks a lot !

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.