Ok, so in in the workspace I have a HingeConstraint and 3 surface GUIs. The surface GUIs are all in one part. The following script is inside one of the TextButtons. The script is NOT a localscript.
local drawhinge = game.Workspace.Walls.Gatehouse.Draw.HingeConstraint --Path to HingeConstraint
local close = script.Parent.Parent.Parent.Close.Close --Path to other TextButton
local open = script.Parent --Path to this TextButton
local statusbar = script.Parent.Parent.Parent.SurfaceGui.statusbar --Path to statusbar textlabel
script.Parent.Activated:Connect(function() --Connect on Activation
print("Activated")--Check if it activated
print("Opening")--Indicate that drawbridge is opening
close.Visible = false --Make other textbutton invisible so it cant be clicked
drawhinge.AngularVelocity = drawhinge.AngularVelocity - 5 --Open drawbridge
statusbar.Text = "Opening..." --Make the status bar indicate that the drawbridge is opening
wait(4)--Wait for it to open
drawhinge.AngularVelocity = 0 --Stop opening Drawbridge
close.Visible = true --Make other textbutton visible again
statusbar.Text = "Open" --Make the status bar indicate that the drawbridge is open
print("Open")--State that the drawbridge is open
end)
When i go in output and test it out, not even the print("activated") function runs. It seems that the textbutton function isn't activating when i click it, and i dont know why.

1 comment
yes the textbutton is script.parent