I have been trying to make a button that connects to a drawbridge, i am hoping that when you click the button, it will make the drawbridge go up, and the button goes green. and when the button is clicked again, the drawbridge goes back down.
This is not a topic on the dev hub yet, and their is no tutorials on YouTube. I am very new to scripting so i do not know exactly how to script yet. Thank you for everyone who replies
You can try to make it as the youtube tutorial says.
But changing the script. For example, if you are using a ClickDetector inside a Part, then you can put the script inside the part and do:
local hinge = script.Parent.HingeConstraint
script.Parent.ClickDetector.MouseClick:Connect(function())
hinge.TargetAngle = 30
wait(2)
hinge.TargetAngle = 0
end)
You can try making a bool outside of the function called isUp and set it to false. Inside the function put isUp = not isUp and again inside the function do
if not isUp then
--make it go up
else
--make it go down
end
Sorry for the terrible grammar I am on mobile right now and I write kinda fast.
This does seem like a script that works, but i am not able to figure out how to exactly do this, the bridge does not move when i click it. and it just spins when i touch it. your very good at explaining its just me who can not figure this out, sorry.
Ah, you need to put “NameOfTheScriptAbove” To the name that you put to your script. for example, if you named it “Friend” then you should change NameOfTheScriptAbove to Friend.