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

Look back script doesn't function as intended?

Asked by 1 year ago

Im making a Nextbot game and I made a script to allow the player to look back (Like Dying Light) but, it turns the player around and makes them go backwards instead of turning the players camera around and allow them to still go forward.

local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char:WaitForChild("Humanoid")

local running = false

local cam = workspace.CurrentCamera


-- Edited
local userinput = game:GetService("UserInputService")

userinput.InputBegan:Connect(function(input)

    if input.KeyCode == Enum.KeyCode.V then
        cam.CFrame = cam.CFrame * CFrame.Angles(0, math.rad(180), 0, 0)
        --print("V press")
    end
end)
-- End Edited


hum.Running:Connect(function(speed)
    if speed > 1 then
        running = true
    else
        running = false
    end
end)

Answer this question