Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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)

2 comments

0

There is one thing that I must point out though camera.CameraType must have an Enum so camera.CameraType = Enum.CameraType.Scriptable

0

Actually this is false. Either works fine.

This discussion is preserved as it was. New answers, comments, and votes are closed.