Help with Changed function? (for alphawolvess)
Before everyone freaks out, Im new, Deal with it
Controls
01 | local player = game.Players.LocalPlayer |
03 | local mouse = player:GetMouse() |
04 | mouse.TargetFilter = game.Workspace.Level |
05 | local runService = game:GetService( 'RunService' ) |
06 | local character = player.Character or player.CharacterAdded:wait() |
08 | local function onCharacterAdded(character) |
09 | local head = character:WaitForChild( 'Head' ) |
10 | gyro = Instance.new( 'BodyGyro' ) |
12 | gyro.MaxTorque = Vector 3. new( 0 , 10000 , 0 ) |
15 | local humanoid = character:WaitForChild( 'Humanoid' ) |
16 | humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false ) |
17 | humanoid:SetStateEnabled(Enum.HumanoidStateType.Climbing, true ) |
20 | local function isnan(x) return x ~ = x end |
22 | local function onRenderStep() |
24 | local mouseHit = mouse.Hit.p |
25 | if not (isnan(mouseHit.X) or isnan(mouseHit.Y) or isnan(mouseHit.Z)) then |
26 | gyro.CFrame = CFrame.new(character.Head.Position, mouseHit) |
31 | while not player.Character do wait() end |
32 | onCharacterAdded(player.Character) |
33 | player.CharacterAdded:connect(onCharacterAdded) |
35 | runService:BindToRenderStep( 'TrackMouse' , Enum.RenderPriority.Input.Value, onRenderStep) |
Flying
01 | local player = game.Players.LocalPlayer |
02 | local camera = script.Parent.Camera |
03 | local controls = script.Parent.Controls |
06 | number = script.Parent.Camera.di |
21 | player.AutoJumpEnabled = false |
25 | if walking = = false then |
26 | if climbing = = false then |
27 | player.CameraMode = Enum.CameraMode.LockFirstPerson |
32 | player.CameraMode = Enum.CameraMode.Classic |
camera
02 | localy = script.di.Value |
03 | local offset = Vector 3. new(y,y,y) |
06 | local player = game.Players.LocalPlayer |
07 | local character = player.Character or player.CharacterAdded:wait() |
08 | local camera = game.Workspace.CurrentCamera |
09 | local runService = game:GetService( 'RunService' ) |
12 | camera.FieldOfView = fieldOfView |
14 | local function onRenderStep() |
15 | local playerPosition = character.Head.Position |
16 | local cameraPosition = playerPosition + offset |
17 | camera.CoordinateFrame = CFrame.new(cameraPosition, playerPosition) |
19 | y.Changed:connect( function (NewValue) end ) |
20 | local playerPosition = character.Head.Position |
21 | local cameraPosition = playerPosition + offset |
22 | camera.CoordinateFrame = CFrame.new(cameraPosition, playerPosition) |
25 | runService:BindToRenderStep( 'Camera' , Enum.RenderPriority.Camera.Value, onRenderStep) |