Python Script Attatched to specific bone?

So I’m working on my third person game project, just trying to refine the movement and control of the character. I’ve got a rig set up where i can rotate a control bone which rotates the head and camera. It works well in animation, but I’m not exactly sure how to set it up so that the bone rotates on the x-axis via mouse control. I have a script that works to rotate an object, but I cant figure out how to attach it to a specific bone. If anyone knows how to achieve this, or just the effect I’m looking for. Please let me know (: Thanks in advanced.

My current set up.
https://imgflip.com/gif/7rcmj

check this out

the cube in the head,

Attachments

example.blend (455 KB)

Similar setup to what I have, when I attach my script to the cube, and make it visible, i can see the cube rotating, but the armature/mesh do not follow. This is the script I’m using

from bge import logic as Gfrom bge import events
sensitivity = 10.0
speed = 0.1
owner = G.getCurrentController() .owner
x = 0.5 - G.mouse.position[0]
y = 0.5 - G.mouse.position[1]


if abs(x) > 0.001 : owner.applyRotation([ 0, 0, x], False)
if abs(y) > 0.001 : owner.applyRotation([ -y, 0, 0], True)
G.mouse.position = (0.5,0.5)

always run armature

in armature

Yup, just used the blend you gave me and attached the script. Tried playing around with it for a bit, but no luck.

When I get online I will take a look at it,

Thanks Blueprint!

Ok, lol,

My subdivision was not applied and was above armature in the modifier stack,

Attachments

example (4).blend (489 KB)

Awesome! Thanks