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

Why has the camera stoped following the players mouse as it used too??(FE)

Asked by 5 years ago

This is a local script in the Gui with FE enabled

local run = true

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

warn("Found the player ["..player.Name.."] for Camera Stuff")
local Helmet = player.Character.Helmet.Handle

local Car = script.Parent.Car.Value
local CarSeat = Car.DriveSeat
local cam = game.Workspace.CurrentCamera
local HelmtTexture = player.Character.Helmet.Handle.TransChange

local HelmetMaterial = player.Character.Helmet.Handle.Material
local CamV = script.Parent.Cam.Value
cam.CameraSubject = player.Character.Head
cam.CameraType = ("Follow")

game:GetService("UserInputService")mouse.KeyDown:connect(function (key)
    key = string.lower(key)
    if key == "c" then
        if CamV == ("first") then
            cam.CameraSubject = player.Character.Head
            cam.CameraType = ("Follow")
            CamV = ("third")
            game:GetService("StarterGui"):SetCore("TopbarEnabled", true)
            Helmet.Transparency = 0
            HelmtTexture.Transparency = 0
        elseif CamV == ("third") then
            CamV = ("first")
        end
    end
end)

script.Parent.Parent.ChildRemoved:connect(function(child)
    run = false

    --[[
    cam.CameraType = "Custom"
    cam.FieldOfView = 80
    cam.CameraSubject = player.Character.Head
    Helmet.Transparency = 0
    player.CameraMaxZoomDistance = 50
    --]]

    player.CameraMinZoomDistance = 0
    script:Destroy()
end)

--FIRST PERSON------------------------------------------------------------------------------------------------------------
game:GetService("RunService").RenderStepped:connect(function()
    if run and CamV == "first" then
        game:GetService("StarterGui"):SetCore("TopbarEnabled", false)
        local XLook = math.max(math.min(((mouse.X-(mouse.ViewSizeX/2))/300)^3,1),-1)
        local YLook = math.max(math.min(((mouse.Y-(mouse.ViewSizeY/2))/300)^3,1),-1)
        local LookOffset = player.Character.Head.CFrame:toWorldSpace(CFrame.new(0,.1,-.5)*CFrame.Angles(-YLook,-XLook,0))
        cam.CameraType = "Scriptable"
        local speed = CarSeat.Velocity.Magnitude
        cam.FieldOfView = ((-100000/((20*speed)+3500))+90)
        HelmtTexture.Transparency = 1
        Helmet.Transparency = 1
        cam.CameraSubject = player.Character.Head
        cam.CoordinateFrame = LookOffset
        player.CameraMaxZoomDistance = 0
    end
end)
---------------------------------------------------------------------------------------------------------------------------

--[[

--THIRD PERSON------------------------------------------------------------------------------------------------------------
game:GetService("RunService").RenderStepped:connect(function()
    if run and CamV == "third" then
        local XLook = math.max(math.min(((mouse.X-(mouse.ViewSizeX/2))/300)^3,1),-1)
        local YLook = math.max(math.min(((mouse.Y-(mouse.ViewSizeY/2))/300)^3,1),-1)
        local LookOffset = player.Character.Head.CFrame:toWorldSpace(CFrame.new(0,2,9)*CFrame.Angles(-YLook,-XLook,0))
        cam.CameraType = "Scriptable"
        cam.FieldOfView = 70
        cam.CameraSubject = player.Character.Head
        cam.CoordinateFrame = LookOffset
        player.CameraMaxZoomDistance = 30
        player.CameraMinZoomDistance = 30
    end
end)
---------------------------------------------------------------------------------------------------------------------------

--]]
0
You’re using deprecated code, wrapping strings in brackets. User#19524 175 — 5y
0
Why did you wrap “first” “third” and all that in brackets? Brackets are math xclusive. User#19524 175 — 5y
0
im new, so i dont know most these things ;/ aleandroblingo -35 — 5y
0
game:GetService("UserInputService")mouse.KeyDown:connect theCJarmy7 1293 — 5y
View all comments (3 more)
0
Can you correct a line so i can do the rest, pls? aleandroblingo -35 — 5y
0
A far as I knew it was a roblox update CarlPlandog 20 — 5y
0
Damn aleandroblingo -35 — 5y

Answer this question