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:
local debounce = false
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if not debounce then
debounce = true
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
game.ReplicatedStorage.Events.Changecam:FireClient(plr,script.Parent.Parent.Cam.CFrame)
wait(1.3)
debounce = false
end
end
end)
Local Script:
game.ReplicatedStorage.Events.Changecam.OnClientEvent:Connect(function(plr, cam)
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = cam
end)
