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

Camera manipulation not working?

Asked by
TudiPYM 12
3 years ago
Edited 3 years ago

I'm trying to make a main menu that shows a scene, so I linked the camera CFrame to a Parts CFrame.

local player = game.Players.LocalPlayer
local character = player.Character
local camera = workspace.CurrentCamera

repeat wait()
    camera.CameraType = Enum.CameraType.Scriptable
until camera.CameraType == Enum.CameraType.Scriptable



script.Parent.ScreenGui.TextButton.MouseButton1Click:Connect(function()
    script.Parent.ScreenGui.TextButton.Visible = false
    repeat wait()
        camera.CameraType = Enum.CameraType.Custom
    until camera.CameraType == Enum.CameraType.Custom
end)

Basically, the button doesn't even work and when I spawn in, the camera is stuck in the air.

http://gyazo.com/879ede2ca5259b3400e09d3956db24f5

Any fixes please?

0
Your making a main menu that is not a GUI? iamajunky 20 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

MouseButton1Click doesn't seem to ever work for me. Try changing it to:

local player = game.Players.LocalPlayer
local character = player.Character
local camera = workspace.CurrentCamera

repeat wait()
    camera.CameraType = Enum.CameraType.Scriptable
until camera.CameraType == Enum.CameraType.Scriptable



script.Parent.ScreenGui.TextButton.MouseButton1Down:Connect(function()
    script.Parent.ScreenGui.TextButton.Visible = false
    repeat wait()
        camera.CameraType = Enum.CameraType.Custom
    until camera.CameraType == Enum.CameraType.Custom
end)

Also you're missing the camera CFrame part so basically it would look like this

local player = game.Players.LocalPlayer
local character = player.Character
local camera = workspace.CurrentCamera

repeat wait()
    camera.CameraType = Enum.CameraType.Scriptable
until camera.CameraType == Enum.CameraType.Scriptable
camera.CFrame = workspace.{PartNameHere}.CFrame


script.Parent.ScreenGui.TextButton.MouseButton1Down:Connect(function()
    script.Parent.ScreenGui.TextButton.Visible = false
    repeat wait()
        camera.CameraType = Enum.CameraType.Custom
    until camera.CameraType == Enum.CameraType.Custom
end)
0
Thank you for the response! But still, the camera is stuck in the air TudiPYM 12 — 3y
0
Updated answer hope it helps CrunchChaotic 139 — 3y
0
IT WORKED! Thank you for helping!! TudiPYM 12 — 3y
Ad

Answer this question