Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Tool0 = Instance.new("Tool")
- MeshPart1 = Instance.new("MeshPart")
- MeshPart2 = Instance.new("MeshPart")
- Motor6D3 = Instance.new("Motor6D")
- Motor6D4 = Instance.new("Motor6D")
- Motor6D5 = Instance.new("Motor6D")
- MeshPart6 = Instance.new("MeshPart")
- MeshPart7 = Instance.new("MeshPart")
- Tool0.Name = "Knife"
- Tool0.Parent = mas
- Tool0.Grip = CFrame.new(-0.0754898861, 2.32830644e-10, -1.3387762e-09, -0.573524714, 0.817766249, 0.0482474938, 0.0752683207, -0.00604268815, 0.997144997, 0.815723062, 0.575518847, -0.0580862574)
- Tool0.GripForward = Vector3.new(-0.0482474938, -0.997144997, 0.0580862574)
- Tool0.GripPos = Vector3.new(-0.0754898861, 2.32830644e-10, -1.3387762e-09)
- Tool0.GripRight = Vector3.new(-0.573524714, 0.0752683207, 0.815723062)
- Tool0.GripUp = Vector3.new(0.817766249, -0.00604268815, 0.575518847)
- MeshPart1.Name = "BiteHandle"
- MeshPart1.Parent = Tool0
- MeshPart1.CFrame = CFrame.new(-6.00714207, 0.648400962, -11.9182758, 1.91068547e-15, 4.37113883e-08, 1, 1, -4.37113883e-08, 0, 4.37113883e-08, 1, -4.37113883e-08)
- MeshPart1.Orientation = Vector3.new(0, 90, 90)
- MeshPart1.Position = Vector3.new(-6.00714207, 0.648400962, -11.9182758)
- MeshPart1.Rotation = Vector3.new(90, 90, 0)
- MeshPart1.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- MeshPart1.Size = Vector3.new(1.12011003, 0.119197004, 0.139892995)
- MeshPart1.BrickColor = BrickColor.new("Really black")
- MeshPart1.Material = Enum.Material.SmoothPlastic
- MeshPart1.Reflectance = 0.20000000298023
- MeshPart1.brickColor = BrickColor.new("Really black")
- MeshPart2.Name = "Blade"
- MeshPart2.Parent = Tool0
- MeshPart2.CFrame = CFrame.new(-6.01316595, 1.55946195, -11.8447742, 1.91068547e-15, 4.37113883e-08, 1, 1, -4.37113883e-08, 0, 4.37113883e-08, 1, -4.37113883e-08)
- MeshPart2.Orientation = Vector3.new(0, 90, 90)
- MeshPart2.Position = Vector3.new(-6.01316595, 1.55946195, -11.8447742)
- MeshPart2.Rotation = Vector3.new(90, 90, 0)
- MeshPart2.Color = Color3.new(0.623529, 0.631373, 0.67451)
- MeshPart2.Size = Vector3.new(0.967115998, 0.232348993, 0.052695401)
- MeshPart2.BrickColor = BrickColor.new("Fossil")
- MeshPart2.Material = Enum.Material.Metal
- MeshPart2.Reflectance = 0.20000000298023
- MeshPart2.brickColor = BrickColor.new("Fossil")
- Motor6D3.Name = "Handle"
- Motor6D3.Parent = MeshPart2
- Motor6D3.C0 = CFrame.new(-0.91118902, 0.0624246597, 0.0059928894, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D3.Part0 = MeshPart2
- Motor6D3.Part1 = MeshPart7
- Motor6D3.part1 = MeshPart7
- Motor6D4.Name = "latch"
- Motor6D4.Parent = MeshPart2
- Motor6D4.C0 = CFrame.new(-1.43141997, 0.0198984146, 0.0058221817, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D4.Part0 = MeshPart2
- Motor6D4.Part1 = MeshPart6
- Motor6D4.part1 = MeshPart6
- Motor6D5.Name = "BiteHandle"
- Motor6D5.Parent = MeshPart2
- Motor6D5.C0 = CFrame.new(-0.911060989, -0.0735015869, 0.00602388382, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D5.Part0 = MeshPart2
- Motor6D5.Part1 = MeshPart1
- Motor6D5.part1 = MeshPart1
- MeshPart6.Name = "latch"
- MeshPart6.Parent = Tool0
- MeshPart6.CFrame = CFrame.new(-6.00734377, 0.128041983, -11.8248758, 1.91068547e-15, 4.37113883e-08, 1, 1, -4.37113883e-08, 0, 4.37113883e-08, 1, -4.37113883e-08)
- MeshPart6.Orientation = Vector3.new(0, 90, 90)
- MeshPart6.Position = Vector3.new(-6.00734377, 0.128041983, -11.8248758)
- MeshPart6.Rotation = Vector3.new(90, 90, 0)
- MeshPart6.Color = Color3.new(0.470588, 0.564706, 0.509804)
- MeshPart6.Size = Vector3.new(0.0714576989, 0.230782002, 0.052695401)
- MeshPart6.BrickColor = BrickColor.new("Sand green")
- MeshPart6.Material = Enum.Material.Metal
- MeshPart6.Reflectance = 0.20000000298023
- MeshPart6.brickColor = BrickColor.new("Sand green")
- MeshPart7.Name = "Handle"
- MeshPart7.Parent = Tool0
- MeshPart7.CFrame = CFrame.new(-6.00717306, 0.648272932, -11.7823496, 1.91068547e-15, 4.37113883e-08, 1, 1, -4.37113883e-08, 0, 4.37113883e-08, 1, -4.37113883e-08)
- MeshPart7.Orientation = Vector3.new(0, 90, 90)
- MeshPart7.Position = Vector3.new(-6.00717306, 0.648272932, -11.7823496)
- MeshPart7.Rotation = Vector3.new(90, 90, 0)
- MeshPart7.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- MeshPart7.Size = Vector3.new(1.12040997, 0.119197004, 0.139892995)
- MeshPart7.BrickColor = BrickColor.new("Really black")
- MeshPart7.Material = Enum.Material.SmoothPlastic
- MeshPart7.Reflectance = 0.20000000298023
- MeshPart7.brickColor = BrickColor.new("Really black")
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Backpack
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
- local r15 = false
- local speed = 7--//AirMaxSpeed
- local fov = 100
- --This part is being modified by Sincerate#3576,
- --just iniate an accelerated back hop
- local c = workspace.Camera
- local FHumanoid = game:GetService("Players").LocalPlayer.Character.Humanoid
- --//////==================================================\\\\\--
- warn'bhop by pdnghiaqoi'
- local player
- local character
- local collider
- local camera
- local input
- local collider
- local playerGrounded
- local playerVelocity
- local jumping
- local moveInputSum
- local dt = 1/60
- local partYRatio
- local partZRatio
- local cameraYaw
- local cameraLook
- local movementPosition
- local movementVelocity
- local gravityForce
- local airAccelerate
- local airMaxSpeed
- local groundAccelerate
- local groundMaxVelocity
- local friction
- local playerTorsoToGround
- local movementStickDistance
- local jumpVelocity
- local movementPositionForce
- local movementVelocityForce
- local maxMovementPitch
- local rayYLength
- local movementPositionD
- local movementPositionP
- local movementVelocityP
- local gravity
- function init(Player, Camera, Input)
- player = Player
- character = player.Character
- collider = character.HumanoidRootPart
- camera = Camera
- input = Input
- playerVelocity = 0
- playerGrounded = false
- moveInputSum = {
- ["forward"] = 0,
- ["side"] = 0 --left is positive
- }
- airAccelerate = 10000
- airMaxSpeed = speed
- groundAccelerate = 250
- groundMaxVelocity = 20
- friction = 10
- playerTorsoToGround = 3
- movementStickDistance = 0.5
- jumpVelocity = 52.5
- movementPositionForce = 400000
- movementVelocityForce = 300000
- maxMovementPitch = 0.6
- rayYLength = playerTorsoToGround + movementStickDistance
- movementPositionD = 125
- movementPositionP = 14000
- movementVelocityP = 1500
- gravity = 0.4
- end
- function initBodyMovers()
- movementPosition = Instance.new("BodyPosition", collider)
- movementPosition.Name = "movementPosition"
- movementPosition.D = movementPositionD
- movementPosition.P = movementPositionP
- movementPosition.maxForce = Vector3.new()
- movementPosition.position = Vector3.new()
- movementVelocity = Instance.new("BodyVelocity", collider)
- movementVelocity.Name = "movementVelocity"
- movementVelocity.P = movementVelocityP
- movementVelocity.maxForce = Vector3.new()
- movementVelocity.velocity = Vector3.new()
- gravityForce = Instance.new("BodyForce", collider)
- gravityForce.Name = "gravityForce"
- gravityForce.force = Vector3.new(0, (1-gravity)*196.2, 0) * getCharacterMass()
- end
- function update(deltaTime)
- dt = deltaTime
- updateMoveInputSum()
- cameraYaw = getYaw()
- cameraLook = cameraYaw.lookVector
- if cameraLook == nil then
- return
- end
- local hitPart, hitPosition, hitNormal, yRatio, zRatio = findCollisionRay()
- partYRatio = yRatio
- partZRatio = zRatio
- playerGrounded = hitPart ~= nil and true or false
- playerVelocity = collider.Velocity - Vector3.new(0, collider.Velocity.y, 0)
- if playerGrounded and (input["Space"] or jumping) then
- jumping = true
- else
- jumping = false
- end
- setCharacterRotation()
- if jumping then
- jump()
- elseif playerGrounded then
- run(hitPosition)
- else
- air()
- end
- end
- function updateMoveInputSum()
- moveInputSum["forward"] = input["W"] == true and 1 or 0
- moveInputSum["forward"] = input["S"] == true and moveInputSum["forward"] - 1 or moveInputSum["forward"]
- moveInputSum["side"] = input["A"] == true and 1 or 0
- moveInputSum["side"] = input["D"] == true and moveInputSum["side"] - 1 or moveInputSum["side"]
- end
- function findCollisionRay()
- local torsoCFrame = character.HumanoidRootPart.CFrame
- local ignoreList = {character, camera}
- local rays = {
- Ray.new(character.HumanoidRootPart.Position, Vector3.new(0, -rayYLength, 0)),
- Ray.new((torsoCFrame * CFrame.new(-0.8,0,0)).p, Vector3.new(0, -rayYLength, 0)),
- Ray.new((torsoCFrame * CFrame.new(0.8,0,0)).p, Vector3.new(0, -rayYLength, 0)),
- Ray.new((torsoCFrame * CFrame.new(0,0,0.8)).p, Vector3.new(0, -rayYLength, 0)),
- Ray.new((torsoCFrame * CFrame.new(0,0,-0.8)).p, Vector3.new(0, -rayYLength, 0))
- }
- local rayReturns = {}
- local i
- for i = 1, #rays do
- local part, position, normal = game.Workspace:FindPartOnRayWithIgnoreList(rays[i],ignoreList)
- if part == nil then
- position = Vector3.new(0,-3000000,0)
- end
- if i == 1 then
- table.insert(rayReturns, {part, position, normal})
- else
- local yPos = position.y
- if yPos <= rayReturns[#rayReturns][2].y then
- table.insert(rayReturns, {part, position, normal})
- else
- local j
- for j = 1, #rayReturns do
- if yPos >= rayReturns[j][2].y then
- table.insert(rayReturns, j, {part, position, normal})
- end
- end
- end
- end
- end
- i = 1
- local yRatio, zRatio = getPartYRatio(rayReturns[i][3])
- while magnitude2D(yRatio, zRatio) > maxMovementPitch and i<#rayReturns do
- i = i + 1
- if rayReturns[i][1] then
- yRatio, zRatio = getPartYRatio(rayReturns[i][3])
- end
- end
- return rayReturns[i][1], rayReturns[i][2], rayReturns[i][3], yRatio, zRatio
- end
- function setCharacterRotation()
- local rotationLook = collider.Position + camera.CoordinateFrame.lookVector
- collider.CFrame = CFrame.new(collider.Position, Vector3.new(rotationLook.x, collider.Position.y, rotationLook.z))
- collider.RotVelocity = Vector3.new()
- end
- function jump()
- collider.Velocity = Vector3.new(collider.Velocity.x, jumpVelocity, collider.Velocity.z)
- air()
- end
- function air()
- movementPosition.maxForce = Vector3.new()
- movementVelocity.velocity = getMovementVelocity(collider.Velocity, airAccelerate, airMaxSpeed)
- movementVelocity.maxForce = getMovementVelocityAirForce()
- end
- function run(hitPosition)
- local playerSpeed = collider.Velocity.magnitude
- local mVelocity = collider.Velocity
- if playerSpeed ~= 0 then
- local drop = playerSpeed * friction * dt;
- mVelocity = mVelocity * math.max(playerSpeed - drop, 0) / playerSpeed;
- end
- movementPosition.position = hitPosition + Vector3.new(0,playerTorsoToGround,0)
- movementPosition.maxForce = Vector3.new(0,movementPositionForce,0)
- movementVelocity.velocity = getMovementVelocity(mVelocity, groundAccelerate, groundMaxVelocity)
- local VelocityForce = getMovementVelocityForce()
- movementVelocity.maxForce = VelocityForce
- movementVelocity.P = movementVelocityP
- end
- function getMovementVelocity(prevVelocity, accelerate, maxVelocity)
- local accelForward = cameraLook * moveInputSum["forward"]
- local accelSide = (cameraYaw * CFrame.Angles(0,math.rad(90),0)).lookVector * moveInputSum["side"];
- local accelDir = (accelForward+accelSide).unit;
- if moveInputSum["forward"] == 0 and moveInputSum["side"] == 0 then --avoids divide 0 errors
- accelDir = Vector3.new(0,0,0);
- end
- local projVel = prevVelocity:Dot(accelDir);
- local accelVel = accelerate * dt;
- if (projVel + accelVel > maxVelocity) then
- accelVel = math.max(maxVelocity - projVel, 0);
- end
- return prevVelocity + accelDir * accelVel;
- end
- function getMovementVelocityForce()
- return Vector3.new(movementVelocityForce,0,movementVelocityForce)
- end
- function getMovementVelocityAirForce()
- local accelForward = cameraLook * moveInputSum["forward"];
- local accelSide = (cameraYaw * CFrame.Angles(0,math.rad(90),0)).lookVector * moveInputSum["side"]
- local accelDir = (accelForward+accelSide).unit
- if moveInputSum["forward"] == 0 and moveInputSum["side"] == 0 then
- accelDir = Vector3.new(0,0,0);
- end
- local xp = math.abs(accelDir.x)
- local zp = math.abs(accelDir.z)
- return Vector3.new(movementVelocityForce*xp,0,movementVelocityForce*zp)
- end
- function getPartYRatio(normal)
- local partYawVector = Vector3.new(-normal.x, 0, -normal.z)
- if partYawVector.magnitude == 0 then
- return 0,0
- else
- local partPitch = math.atan2(partYawVector.magnitude,normal.y)/(math.pi/2)
- local vector = Vector3.new(cameraLook.x, 0, cameraLook.z)*partPitch
- return vector:Dot(partYawVector), -partYawVector:Cross(vector).y
- end
- end
- function getYaw() --returns CFrame
- return camera.CoordinateFrame*CFrame.Angles(-getPitch(),0,0)
- end
- function getPitch() --returns number
- return math.pi/2 - math.acos(camera.CoordinateFrame.lookVector:Dot(Vector3.new(0,1,0)))
- end
- function getCharacterMass()
- return character.HumanoidRootPart:GetMass() + character.Head:GetMass()
- end
- function magnitude2D(x,z)
- return math.sqrt(x*x+z*z)
- end
- local inputKeys = {
- ["W"] = false,
- ["S"] = false,
- ["A"] = false,
- ["D"] = false,
- ["Space"] = false,
- ["LMB"] = false,
- ["RMB"] = false
- }
- local plr = game:GetService("Players").LocalPlayer
- script.Parent = plr.PlayerGui
- local camera = workspace.CurrentCamera
- local UserInputService = game:GetService("UserInputService")
- function onInput(input, gameProcessedEvent)
- local inputState
- --print(input.KeyCode)
- if input.UserInputState == Enum.UserInputState.Begin then
- inputState = true
- elseif input.UserInputState == Enum.UserInputState.End then
- inputState = false
- else
- return
- end
- if input.UserInputType == Enum.UserInputType.Keyboard then
- local key = input.KeyCode.Name
- if inputKeys[key] ~= nil then
- inputKeys[key] = inputState
- end
- elseif input.UserInputType == Enum.UserInputType.MouseButton1 then --LMB down
- inputKeys.LMB = inputState
- elseif input.UserInputType == Enum.UserInputType.MouseButton2 then --RMB down
- inputKeys.RMB = inputState
- end
- end
- function main()
- local a = plr.Character:FindFirstChildOfClass("Humanoid") or plr.Character:WaitForChild("Humanoid");
- a.PlatformStand = true
- --init movement
- init(plr, camera, inputKeys);
- initBodyMovers();
- --connect input
- UserInputService.InputBegan:connect(onInput);
- UserInputService.InputEnded:connect(onInput);
- --connect updateloop
- game:GetService("RunService"):BindToRenderStep("updateLoop", 1, updateLoop);
- --rip
- end
- local prevUpdateTime = nil
- local updateDT = 1/60
- function setDeltaTime() --seconds
- local UpdateTime = tick()
- if prevUpdateTime ~= nil then
- updateDT = (UpdateTime - prevUpdateTime)
- else
- updateDT = 1/60
- end
- prevUpdateTime = UpdateTime
- end
- function updateLoop()
- setDeltaTime();
- update(updateDT);
- end
- main()
- while true do
- local mouseeeee = game.Players.LocalPlayer:GetMouse()
- mouseeeee.Icon = "rbxassetid://330553538"
- wait(0.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement