So i made a script: when the player clicks a block, it changes the camera's Subject to the clicked block, but for some reason it just does not work, this is the script:
local camera = workspace.CurrentCamera function GoBuild() camera.CameraSubject = script.Parent end script.Parent.ClickDetector.MouseClick:Connect(GoBuild)
Its located here: https://prnt.sc/ms2dtm ...
For some reason it does not even leave a console error, I would appreciate if someone could help me :D!
Ok so this code is perfectly fine, however, you need to make sure this is in a LocalScript
for it to run.
You can also place the function connection in the same line as its definition.
CameraSubject
changes a camera's focus, if you also want to change its positon, you need to add the camera's CFrame property.
Revised LocalScript under StarterGui
local camera = workspace.CurrentCamera local part = workspace.Part -- whatever "script.Parent" is part.ClickDetector.MouseClick:Connect(function() camera.CameraSubject = part camera.CFrame = part.CFrame end)