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

Help with Changed function? (for alphawolvess)

Asked by 7 years ago

Before everyone freaks out, Im new, Deal with it 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)

Flying

local player = game.Players.LocalPlayer
local camera = script.Parent.Camera
local controls = script.Parent.Controls
walking = true
climbing = true
number = script.Parent.Camera.di
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
end
else
    player.CameraMode = Enum.CameraMode.Classic
    number.Value = 40
    end


camera

x = script.Fov.Value
localy = script.di.Value
local offset = Vector3.new(y,y,y)
local fieldOfView = x

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
local camera = game.Workspace.CurrentCamera
local runService = game:GetService('RunService')


camera.FieldOfView = fieldOfView

local function onRenderStep()
    local playerPosition = character.Head.Position
    local cameraPosition = playerPosition + offset
    camera.CoordinateFrame = CFrame.new(cameraPosition, playerPosition)
end
  y.Changed:connect(function(NewValue) end)
    local playerPosition = character.Head.Position
    local cameraPosition = playerPosition + offset
    camera.CoordinateFrame = CFrame.new(cameraPosition, playerPosition)
end

runService:BindToRenderStep('Camera', Enum.RenderPriority.Camera.Value, onRenderStep)

1 answer

Log in to vote
0
Answered by 7 years ago

It would help if you said what is wrong. Like paste the error or something

Ad

Answer this question