I have a TextButton in a ScreenGui which is only visible to certain playerIDs. When pressed, it's meant to move a brick by the name of Void1 from game.Lighting to workspace, and then do the same thing with a brick named Void2, then change the text and background color of the button. When pressed again, it's meant to do the same thing in reverse.
However, upon testing, when I press the button, nothing happens. This is odd, because there aren't any errors either. I'm not sure if there's anything I'm doing wrong, if so please let me know. I'm very new to Lua.
function parentPressed()
game.Lighting.Void1.Parent = workspace
game.Lighting.Void2.Parent = workspace
script.Parent.Text = "MidVoid: Enabled"
script.Parent.BackgroundColor3 = Color3.fromRGB(116, 255, 65)
end
script.Parent.MouseButton1Down:connect(parentPressed)
if parentPressed() == true then
function parentPressedAgain()
game.Workspace.Void1.Parent = game.Lighting
game.Workspace.Void2.Parent = game.Lighting
script.Parent.Text = "MidVoid: Disabled"
script.Parent.BackgroundColor3 = Color3.fromRGB(255, 57, 57)
end
script.Parent.MouseButton1Down:connect(parentPressedAgain)

2 comments
Out of curiosity, is this a server-side script?
Yes, sorry for not responding. It's a server-side script rather than a localscript. I now realize that it needs to be done with a localscript that fires a RemoteEvent, I figured that out soon after I created the post, so I kinda just ditched this idea altogether.