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

Camera not staying in position?? Please help!![solved]

Asked by 6 years ago
Edited 6 years ago

I'm trying to make a top down action view game and I need to have a camera where you can't rotate it(not in normal ROBLOX gameplay) I tried to do it with a click detector, it worked but when I deleted the click detector and the event it didn't work

So here is the hierarchy for the local script

Part -> game.Workspace.CameraPart LocalScript -> game.StarterPlayer.LocalScript

Here is also the hierarchy for the global script

Part -> game.Workspace.CameraPart GlobalScript-> game.Workspace.CameraPart.Script

Here is also the lines of code for both of the scripts

local camera = workspace.CurrentCamera
game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function()
    camera.CameraType = Enum.CameraType.Scriptable
    camera.HeadLocked = false
    camera.CFrame = CFrame.new(script.Parent.Position)
    end)
end)

Whoever can answer this question, please immediatley type it down if you can From : saSlol2436

1 answer

Log in to vote
0
Answered by 6 years ago

So basically what you're going to want to do is make the CameraType Scriptable, as well as using camera.CoordinateFrame.

local camera = workspace.CurrentCamera
game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function()
    camera.CameraType = "Scriptable"
    camera.CameraSubject = script.Parent
    camera.HeadLocked = false
    camera.CoordinateFrame = script.Parent.CFrame
    end)
end)
0
There is one thing that I must point out though camera.CameraType must have an Enum so camera.CameraType = Enum.CameraType.Scriptable saSlol2436 716 — 6y
0
Actually this is false. Either works fine. LordOfLuxury 84 — 6y
Ad

Answer this question