So just trying to make a button that would let u spectate any tool. Lol sorry im not very good with camera manipulation

-- Local Script --
local repl = game.ReplicatedStorage
local cam = game.Workspace.CurrentCamera

script.Parent.MouseButton1Click:Connect(function()
	if game.Workspace:FindFirstChild("Ball") then
		repl.Spectate:FireServer("BallWorkspace",cam) 
	elseif not game.Workspace:FindFirstChild("Ball") then
		repl.Spectate:FireServer("BallPerson",cam)
	else repl.Spectate:FireServer("BackToPerson", cam)
	end
end)

local replicated = game.ReplicatedStorage
local Event = replicated.Spectate

Event.OnServerEvent:Connect(function(player, check, Cam)
	if check == "BallWorkspace" then
		Cam.CameraSubject = game.Workspace:FindFirstChild("Ball").Handle	
		Cam.CameraType = "Custom"
	elseif check == "BallPerson" then
		for i,v in pairs (game.Players:GetPlayers()) do
			if v.Backpack:FindFirstChild("Ball") then
			Cam.CameraSubject = v.Backpack:FindFirstChild("Ball").Handle
			Cam.CameraType = "Custom"
	elseif check == ("BackToPerson") then
			if Cam.CameraSubject == not player.Character.Humanoid then
			Cam.CameraSubject = player.Character.Humanoid
			Cam.CameraType = "Custom"
			end	
			end
		end
	end
end)

5 comments

1

Your local script first checks if the Ball is in the workspace, then checks if it's not in the workspace, one of those two will always be true. the back to person cam is fired on an ELSE that will never hit.

0

soo uhhh what do i do :/ im not good at this

1

I'm not sure what you're trying to achieve exactly. When are you wanting to return to the normal camera.

0

uhhh dm me on disc dogovpain#8788

1

You can't pass the camera of the client to the server in an event. Do what you have in the server script inside of the local script's MouseButton1Click event.