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

How to change angle of HingeConstraint from a script?

Asked by 2 years ago

My current HingeConstraint can go from -90 to +90. The door works by walking into it. I followed the guide on https://developer.roblox.com/en-us/onboarding/building-a-hinged-door/1

I'm in the process of writing a script to make the door go back to its original position after a certain amount of time by utilizing HingeConstraint.CurrentAngle

Let's say the current angle is +90 The default angle is 0 Is it as easy as HingeConstraint.CurrentAngle = 0

local door = script.Parent
local hinge = script.Parent.doorWoodPlank.doorWoodBlank.HingeConstraint

local function reset()
    wait(3)
    hinge.CurrentAngle = 0
end

door.doorWoodPlank.doorWoodBlank.Touched:Connect(reset)

Only error message in output:

can't set value - Server - autoCloseDoor:6

Help is appreciated, thank you in advance

0
Im really sorry idk :( DefinitelyNotTronix 19 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

So it turns out to answer my own question HingeConstraint.CurrentAngle is READABLE only (I was trying to change its value)

0
you should change TargetAngle instead boomthefist 6 — 2y
Ad

Answer this question