Here is a section of code. I need the game to be able to figure out if the player is either walking or climbing, but I don't really know what to put there. Please help.
local player = game.Players.LocalPlayer
walking =
climbing =
player.AutoJumpEnabled = false
if walking = false and climbing = false then
player.CameraMode = LockFirstPesron
end
else
player.CameraMode = Classic
end
Also here is the rest of the code for reference. Flying (Camera Change)
local player = game.Players.LocalPlayer
walking = true
climbing = true
number = script.Parent.Camera.di.Value
wait(1)
print("beep")
wait(1)
print("beep")
wait(1)
print("beep")
wait(1)
print("beep")
wait(1)
print("beep")
walking = false
climbing = false
player.AutoJumpEnabled = false
if walking == false then
if climbing == false then
player.CameraMode = Enum.CameraMode.LockFirstPerson
print('done')
number.Value = 0 -- This is another error
end
else
player.CameraMode = Enum.CameraMode.Classic
number.Value = 40 --This is another error,again
end
Camera
x = script.Fov.Value
y = script.di.Value
local offset = Vector3.new(y,y,y)
local fieldOfView = x
local player = game.Players.LocalPlayer
local camera = game.Workspace.CurrentCamera
local runService = game:GetService('RunService')
local character = player.Character or player.CharacterAdded:wait()
camera.FieldOfView = fieldOfView
local function onRenderStep()
local playerPosition = character.Head.Position
local cameraPosition = playerPosition + offset
camera.CoordinateFrame = CFrame.new(cameraPosition, playerPosition)
end
runService:BindToRenderStep('Camera', Enum.RenderPriority.Camera.Value, onRenderStep)
Controls
local player = game.Players.LocalPlayer
local gyro = nil
local mouse = player:GetMouse()
mouse.TargetFilter = game.Workspace.Level
local runService = game:GetService('RunService')
local character = player.Character or player.CharacterAdded:wait()
local function onCharacterAdded(character)
local head = character:WaitForChild('Head')
gyro = Instance.new('BodyGyro')
gyro.P = 50000
gyro.MaxTorque = Vector3.new(0, 10000, 0)
gyro.Parent = head
local humanoid = character:WaitForChild('Humanoid')
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
humanoid:SetStateEnabled(Enum.HumanoidStateType.Climbing, true)
end
local function isnan(x) return x ~= x end
local function onRenderStep()
if gyro then
local mouseHit = mouse.Hit.p
if not (isnan(mouseHit.X) or isnan(mouseHit.Y) or isnan(mouseHit.Z)) then
gyro.CFrame = CFrame.new(character.Head.Position, mouseHit)
end
end
end
while not player.Character do wait() end
onCharacterAdded(player.Character)
player.CharacterAdded:connect(onCharacterAdded)
runService:BindToRenderStep('TrackMouse', Enum.RenderPriority.Input.Value, onRenderStep)

1 comment
https://forum.scriptinghelpers.org/topic/82/how-to-format-questions-answers-on-the-main-site