Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does this spectate button not let me return to the normal camera pos?

Asked by 5 years ago

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)
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. GoodCallMrOlsen 70 — 5y
0
soo uhhh what do i do :/ im not good at this WillBe_Stoped 71 — 5y
1
I'm not sure what you're trying to achieve exactly. When are you wanting to return to the normal camera. GoodCallMrOlsen 70 — 5y
0
uhhh dm me on disc dogovpain#8788 WillBe_Stoped 71 — 5y
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. xPolarium 1388 — 5y

Answer this question