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

Why isn't it changing the perspective of the player?

Asked by 4 years ago
Edited 4 years ago
local text1 = "Player Perspective?"
local text2 = "Camera Perspective?"
local button = script.Parent.Perspective

local function OnClick()
    -- PlayerPerspective --
    if button.Text == text1 then
        local Camera = game.Workspace.CurrentCamera
        local plr = game.Players.LocalPlayer

        Camera.CameraType = "Follow"
        Camera.CFrame = plr.Character.Head.CFrame

        button.Text = text2
    end
    -- CameraPerspective --
    if button.Text == text2 then
        local Camera = game.Workspace.CurrentCamera
        local plr = game.Players.LocalPlayer

        Camera.CameraType = "Scriptable"
        Camera.CFrame = game.Workspace.CamPart.CFrame

        button.Text = text1
    end
end

button.MouseButton1Click:Connect(OnClick) -- Make sure not to type OnClick()! Pass the function, don't run it!

I'm not getting errors at all, and this is a local script inside of a screen GUI that is inside of starter GUI. Please help! (btw, a dude helped me already. If you see this then tell me your username and I'll give credit.)

Thanks,

Narwhal

1 answer

Log in to vote
0
Answered by
acuaro 29
4 years ago

Ok, I see the problem. What I would do is not use `Camera.CameraType = "Follow Camera.CFrame = plr.Character.Head.CFrame'

I think you can just put the camera as "Fixed" and instead of Camera.CFrame do Camera.CamerSubject

Hope I could Help!

0
let me go see if it works, thanks for your contribution! NarwhalAndMe 141 — 4y
0
Unfortunatly, It didn't work. Sorry! Also, there was no errors NarwhalAndMe 141 — 4y
Ad

Answer this question