Change script/part properties by clicking a GUI button

Hey Devs! I’m making a tool that’s spawning parts when clicked. I added a “properties” GUI to change the part’s properties. Everything is in local scripts, so I need to make a script in the tool or send the .Anchored value from the button to the tool or in a different way.

  1. What do I want to achieve? If I click the button, .Anchored value must change from false to true to spawn the part with that value. (Parts create by a tool!)

  2. What is the issue? The .Anchored value isn’t changing.
    image

    image

  3. What solutions have I tried so far? I tried making many scripts in the tool, button. I tried using events and Boolvalues, but nothing worked. I searched the internet too.
    Thanks for all the answers!

You would need to create a BoolValue/Attribute, clicking the button changes the Value/Attribute, and you will just need to set Part.Anchored to the attributes value.

1 Like

I’m not sure if I’m reading your question right, but the script is setting the “Anchored” property to false when you say you want it to be true. Switch “false” to “true”

This create part script is… creating parts. When I’m in game I want to click the button to change the .anchored value from false to true.

So what you want to do is have it spawn the part anchored or not depending on the setting? set a variable like “anchor” to false outside of the functions (below the GUI variable). In the “AnchorTrue” function, write “anchor = not anchor”, and have the “create part” function set the part’s Anchored property to the “anchor” variable

I solved it. Thanks for your reply!

I couldn’t do it without you! :heart:

1 Like