Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I rigged a robot with hinge constraints but now I can't get the TargetValue to change?

Asked by 7 years ago

Okay, so here's the code. I built a giant robot which flies; and I eliminated extra scripting by using constraints for the limbs. A value in the robot holds a number 1-3. When the value changes the code below should run the statuschanged() function, and change the robot's constraint's TargetAngles. When I change the value, the TargetAngle values do not change. why? What did I do wrong?

Chamber = script.Parent.BodyKit.CHAMBER
pose=script.Parent.Pose
--1flying, 2standing, 3kneeling

        Chamber.Torso.LeftHip.Speed = 1
        Chamber.Torso.LeftShoulder.Speed = 1
        Chamber.Torso.RightHip.Speed = 1
        Chamber.Torso.RightShoulder.Speed = 1
        Chamber.UpperLeftleg.LeftKnee.Speed = 1
        Chamber.UpperRightLeg.RightKnee.Speed = 1
        Chamber.UpperLeftArm.LeftElbow.Speed = 1
        Chamber.UpperRightArm.RightElbow.Speed = 1

function statusChanged()
    if pose.Value == 1 then
wait()
        Chamber.Torso.LeftHip.TargetAngle = -45
        Chamber.Torso.LeftShoulder.TargetAngle = 40
        Chamber.Torso.RightHip.TargetAngle = 0
        Chamber.Torso.RightShoulder.TargetAngle = -40
        Chamber.UpperLeftleg.LeftKnee.TargetAngle = -90
        Chamber.UpperRightLeg.RightKnee.TargetAngle = -45
        Chamber.UpperLeftArm.LeftElbow.TargetAngle = 0
        Chamber.UpperRightArm.RightElbow.TargetAngle = 0
    --[[elseif pose.Value == 2 then
        --insert stand presets
    elseif pose.Value == 3 then
        --insert kneel presets
    end]]
    end
    end


pose.Changed:connect(statusChanged)
0
Servo. And the force is set to inf and the speed is set to 1. alonzo12345 60 — 7y

Answer this question