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

[NOT SOLVED] Why my camera system works in Studio but not in Online mode?

Asked by 9 years ago

Okay, last days I've been experimenting with camera manipulation and so, I've successfully developed a GUI in where when you press the TextButton with a name, the LocalScript will search in ReplicatedStorage for a folder named Cameras, in which, it should have a Camera with the same name of the TextButton. And then, the script should change the CameraType to "Scripted" and clone the CoordinateFrame, Focus and FieldOfView from the original camera to the CurrentCamera.

After that, the player can close the gui and so, it will return to the normal camera.

My big problem is: It works on Studio Solo, but not in Online mode! I've already tried everything, since waiting until a plr.Character is not equal to nil, to disabling the entire FilteringEnabled system!

I will not post the entire script here, instead, I will make a short resume.

repeat wait() until game.Players.LocalPlayer.Character
wait(1)

local plr = game.Players.LocalPlayer
local curcam = game.Workspace.CurrentCamera
local monitor = false
local button = script.Parent:FindFirstChild("Toggle")
local cameras = game.ReplicatedStorage:FindFirstChild("Cameras")
local gui = script.Parent:FindFirstChild("MonitorScheme")
local choices = gui:FindFirstChild("Choices")

local currentCamera = nil
local lastCamera = choices.MainCorridor

function changeCamera(node)
    if lastCamera == node then return end
    if node and cameras:FindFirstChild(node.Name) then
        lastCamera = node
        currentCamera = node
        ccam = cameras:FindFirstChild(node.Name)
        curcam.CameraType = "Scriptable"
        curcam.CoordinateFrame = ccam.CoordinateFrame
        curcam.Focus = ccam.Focus
    end
end

function onToggled()
    if not monitor then
        monitor = true
        gui.Visible = true
        changeCamera(lastCamera)
    else
        monitor = false
        gui.Visible = false
        currentCamera = nil

        curcam.CameraType = "Custom"
        curcam.CameraSubject = plr.Character:FindFirstChild("Humanoid")
        curcam.FieldOfView = 70
    end
end

function init()
    for _, c in pairs(choices:GetChildren()) do
        if c:IsA("TextButton") then
            c.MouseButton1Down:connect(c)
        end
    end
end

init()

Please don't mind any syntax errors. As I said before, this is a resume and is not meant to work. It's just to showcase the script. But, this example and the original script won't work, only the gui will show up, the cameras won't change but the variables do. No errors printed in the output.

0
There may be a bug in the original script and we can't fix it if we only have a partial version of it. Please edit your post and put the full origninal. yoshiegg6 176 — 9y
0
@yoshiegg6 Actually, this is my sandboxed version. The original only have some special effects more, but they're in a totally different script. This resume is just like the script, it works as same as the other script do in studio, but not in online mode. lucas200206 90 — 9y
0
Oops, my mystake on the above comment, I meant it works just like the other script, but aswell as the other script, it only works at studio mode and not online mode. lucas200206 90 — 9y
0
Erm, Bump. lucas200206 90 — 9y

Answer this question