Camera wont change when touching trigger?
So i was trying to make it so that once you touch the trigger it will set the camera's position to the part's but thing is didnt work and the output printed this:
21:34:03.096 Players.GameBuilderLol.PlayerScripts.LocalScript:9: invalid argument #3 (CFrame expected, got nil) - Client - LocalScript:9
Server Script:
03 | script.Parent.Touched:Connect( function (hit) |
04 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
07 | local plr = game.Players:GetPlayerFromCharacter(hit.Parent) |
08 | game.ReplicatedStorage.Events.Changecam:FireClient(plr,script.Parent.Parent.Cam.CFrame) |
Local Script:
01 | game.ReplicatedStorage.Events.Changecam.OnClientEvent:Connect( function (plr, cam) |
02 | local Player = game.Players.LocalPlayer |
03 | local Character = Player.Character or Player.CharacterAdded:Wait() |
04 | local Camera = workspace.CurrentCamera |
07 | Camera.CameraType = Enum.CameraType.Scriptable |
08 | until Camera.CameraType = = Enum.CameraType.Scriptable |