TextButton won't activate

cameraToggleButton = script.Parent

cameraToggleButton.Activated:Connect(function()

cameraNumberValue.Value += 1

cameraToggleButton.Parent.Enabled = false

end)

This is a LocalScript under a TextButton under a SurfaceGui under a part, I honestly have no idea what is causing this. I used print but that doesn’t print. No errors. Just nothing happens despite it being a 4 line function with little to it.

Server script or local script?

Local scripts will not work if it is a descendant of the workspace.

1 Like

Ok let me see if changing this around to be server-side works. Thanks.

Edit: Yeah I used print on the server-side script and that did not work.

What do you want to do? Activate the Textbutton? Because cameraToggleButton.Activated:Connect(function() will just run if the Button is activated but i dont see where u trying to active the Button

1 Like

I would suggest using click detectors for a surface gui and going from there.

Could we get a screenshot of your layout?

1 Like


Screenshot_208

Screenshot 1: Probably not as helpful. It is where the text button is when visible (it becomes visible in another LocalScript).

Screenshot 2: Probably more helpful. The explorer directory where the LocalScript is located in.

To make it so that the button (cameraToggleButton as the script.Parent), when clicked/tapped depending on the device will run the code in the function it is connected to.

its because that one thing
eeee

1 Like
  1. the script is in the workspace which stops local scripts from running
  2. the button in the surface gui not the screen gui
  3. if the gui is a billboard gui and not surface gui then that explains everything, for some reason, billboard gui doesn’t detect user input, so you’ll have to put it in the PlayerGui/StarterGui and set the Adornee to the LaptopScreen
2 Likes

Yeah at this point I am just going to use a screenGui and make it “fit” onto the laptopScreen like I did before I tried to convert it to a SurfaceGui for convenience.

Edit: Ok I found out how to make it work and it took me way too long considering my coding skills. I just put the local script into StarterPlayerScripts, a LocalScript compatible parent/ancestor, and modified the LocalScript for the Guis. I’m just gonna give the first person who told me that workspace is not a compatible parent/ancestor for LocalScripts the solution thing.

1 Like