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

Why won't my script work online?

Asked by 9 years ago

Well I have a script that makes a camera circle the baseplate. And this is the script inside the play button, But when I click it in Studio it switches back to my Original character. But online it just stay focused on the baseplate but doesn't move. Can someone tell me whats wrong this script?

P = script.Parent
S = script.Parent.Parent.Shop
A = script.Parent.Parent.About
C = script.Parent.Parent.Credits
local Camera = game.Workspace.CurrentCamera
local Focus = Camera.Focus
local Character = game.Players.LocalPlayer

function play()
    P.Visible = false
    A.Visible = false
    C.Visible = false
    S.Visible = true
    script.Parent.Parent.LocalScript.Disabled = true -- LocalScript is the script for the circling base
    Camera.CameraSubject = game.Players.LocalPlayer.Character
    Camera.CameraType = ("Custom")
end

script.Parent.MouseButton1Up:connect(play)

This is the script that makes the camera circle the baseplate

local target = workspace.BasePlate
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
--camera.Focus = CFrame.new(target.Position)
local angle = 0
local i = 0

while wait() do
    camera.CoordinateFrame = CFrame.new(target.Position)  --Start at the position of the part
                            * CFrame.Angles(0, angle, 0) --Rotate by the angle
                            * CFrame.new(0, 200, 500)       --Move the camera backwards 5 units
    --camera.Focus = CFrame.new(target.Position)
    angle = angle + math.rad(1)
end

1 answer

Log in to vote
0
Answered by 9 years ago
P = script.Parent
S = script.Parent.Parent.Shop
A = script.Parent.Parent.About
C = script.Parent.Parent.Credits
local Camera = game.Workspace.CurrentCamera
local Focus = Camera.Focus
local Character = game.Players.LocalPlayer

function play()
    P.Visible = false
    A.Visible = false
    C.Visible = false
    S.Visible = true
    script.Parent.Parent.LocalScript.Disabled = true -- LocalScript is the script for the circling base
    Camera.CameraSubject = game.Players.LocalPlayer.Character
    Camera.CameraType = ("Custom")
end

script.Parent.MouseButton1Up:connect(play)
local target = workspace.BasePlate
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
--camera.Focus = CFrame.new(target.Position)
local angle = 0
local i = 0

while wait() do
    camera.CoordinateFrame = CFrame.new(target.Position)  --Start at the position of the part
                            * CFrame.Angles(0, angle, 0) --Rotate by the angle
                            * CFrame.new(0, 200, 500)       --Move the camera backwards 5 units
    --camera.Focus = CFrame.new(target.Position)
    angle = angle + math.rad(1)
end

Everything looks good, but if it's in a normal script put it in a localscript.

Ad

Answer this question