So, I'm using a remote event. The localscript fires the server of the event when the player is respawned. It passes the player's mouse, and currentcamera. For some reason I get an error saying that CurrentCamera is a nil value. Can you handle the currentcamera and mouse in a server script?
Here's my RemoteEvent code:
game.ReplicatedStorage.RemoteEvents.Spawn.OnServerEvent:Connect(function(plr, ...)
local args = {...}
local request = args[1]
local camera = args[2]
local mouse = args[3]
local char = plr.Character
local humanoid = plr.Character.Humanoid
local torso
if request == "Start" then
local model = game.ServerStorage.Objects.SpawnModel
local clone = model:Clone()
clone.Parent = camera
print(camera.Name) --> This prints nil
if humanoid.RigType == Enum.HumanoidRigType.R6 then
torso = plr.Character.Torso
elseif humanoid.RigType == Enum.HumanoidRigType.R15 then
torso = plr.Character.HumanoidRootPart
end
torso.CFrame = model:FindFirstChild('TeleportPart').CFrame + Vector3.new(0,3,0)
torso.Anchored = true
wait()
if char:FindFirstChild('ForceField') ~= nil then char.ForceField:Destroy() end
end
end)

2 comments
You can't pass the actual camera object over. Pass any properties you need to access.
Well I need to actually set the parent of model to the camera. Have an idea of how to do this?