I have been baffled by this for a week by now. I have been trying to make a text button on a GUI to work. There isn't any issue as far as I can see, and cross referencing with the wiki's hasn't helped. The button is supposed to make the camera follow a separate block. Although the camera code works the button hasn't worked once. Any Help is appreciated, thanks.
local Button = WOORK -- Button name function Onclick(part) local target = Workspace.BattleShip.BCameraBlock-- Beginning working part of camera local camera = Workspace.CurrentCamera camera.CameraType = "Follow" camera.CameraSubject = target camera.CameraMinZoomDistance= 5 Camera.CameraMaxZoomDistance= 10 -- end of working part of camera end Onclick(Button.MouseButton1Click)
At the end of the script you put:
Onclick(Button.MouseButton1Click)
What that does is it runs the function Onclick for Button.MouseButton1Click as the part. You should have this at the end:
Button.MouseButton1Click:connect(onClick)
That will connect to the Onclick function when Button is clicked.
Make sure Button is referenced in the script as script.Parent or something.