Hello! I am currently making a fnaf game. And obviously I have a Camera System. But I am having a problem with functions and parameters.
Here is my code (local script):
local cam = workspace.CurrentCamera
--Current Camera
local SFMap = script.Parent
--Second Floor Map
local SFFolder = game.Workspace.Cameras.SecondFloor
local Cam09 = SFFolder.CamPart09
local Cam10 = SFFolder.CamPart10
local function ChangingCam(Camera)
cam.CameraSubject = Camera
end
--function
SFMap.Cam09.MouseButton1Click:Connect(ChangingCam(Cam09))
SFMap.Cam10.MouseButton1Click:Connect(ChangingCam(Cam10))
Can you tell me what I am doing wrong?
The Output says “attempt to call a nil value”
As of right now I am doing a "cleaning of codes’. What I do is take codes like we had here (before, they were individual). And now I put them in one script, then ask on the forum how I can improve it.
Thanks for reading!