How to unanchore a part when a changing text says ...?

Hello,

I currently am trying to make a part unanchor when a textlable is …, i am trying to make this for a realistic vehicle system.

I have tried many times but i dont understand how to changing scripts work.
This is all that i have:

  • When you click a button, a textlabel changes from 1 to 25
  • How can i make when the textlabel has changed to 25, a part thats inside that model gets unanchored?
  • So like when the textlabel says 25 the part is unanchored, but when the textlabel, is changing then the part is anchored.

I really dont understand how i make scripts when textlabels are changing.

EDIT: I HAVE FOUND A SOLUTION

If you copy/post the script here we can help you better. Please put 3 backticks (```) before and after it so it formats properly.

Basically you already have your counter built in when you click your GUI. Every time you click you make your variable add one. For example if you use the variable counter then every time you click have the line counter += 1.
Next is a check to see if counter is 25 (or greater just in case the player gets a couple of clicks in due to lag)

if counter >= 25 then 
    -- your code here to unanchor the part, I used the variable cantmove 
    -- that  you'll need to identify as your anchored Part in the car)
    local cantmove.Anchored = false
end
textLabel:GetPropertyChangedSignal("Text"):Connect(function()
	local count = math.round(tonumber(textLabel.Text)) -- round just to be sure (to avoid results like 25.00002)
	if count == 25 then
		part.Anchored = false
	end
end)
1 Like

I have found a solution.

thanks for everyone for helping.

Would you mind sharing it? For future readers and to see if you’re applying right practices.

Well i was a little dumb and forgot that if i put in the script that changes the number to 25 i can just put unanchor the part there.

I was making a new script and i have alot of scripts so i just forgot.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.