Advertisement
Sincerate

Untitled

Sep 6th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.04 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5. --Converted with ttyyuu12345's model to script plugin v4
  6. function sandbox(var,func)
  7.     local env = getfenv(func)
  8.     local newenv = setmetatable({},{
  9.         __index = function(self,k)
  10.             if k=="script" then
  11.                 return var
  12.             else
  13.                 return env[k]
  14.             end
  15.         end,
  16.     })
  17.     setfenv(func,newenv)
  18.     return func
  19. end
  20. cors = {}
  21. mas = Instance.new("Model",game:GetService("Lighting"))
  22. Tool0 = Instance.new("Tool")
  23. MeshPart1 = Instance.new("MeshPart")
  24. MeshPart2 = Instance.new("MeshPart")
  25. Motor6D3 = Instance.new("Motor6D")
  26. Motor6D4 = Instance.new("Motor6D")
  27. Motor6D5 = Instance.new("Motor6D")
  28. MeshPart6 = Instance.new("MeshPart")
  29. MeshPart7 = Instance.new("MeshPart")
  30. Tool0.Name = "Knife"
  31. Tool0.Parent = mas
  32. 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)
  33. Tool0.GripForward = Vector3.new(-0.0482474938, -0.997144997, 0.0580862574)
  34. Tool0.GripPos = Vector3.new(-0.0754898861, 2.32830644e-10, -1.3387762e-09)
  35. Tool0.GripRight = Vector3.new(-0.573524714, 0.0752683207, 0.815723062)
  36. Tool0.GripUp = Vector3.new(0.817766249, -0.00604268815, 0.575518847)
  37. MeshPart1.Name = "BiteHandle"
  38. MeshPart1.Parent = Tool0
  39. 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)
  40. MeshPart1.Orientation = Vector3.new(0, 90, 90)
  41. MeshPart1.Position = Vector3.new(-6.00714207, 0.648400962, -11.9182758)
  42. MeshPart1.Rotation = Vector3.new(90, 90, 0)
  43. MeshPart1.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  44. MeshPart1.Size = Vector3.new(1.12011003, 0.119197004, 0.139892995)
  45. MeshPart1.BrickColor = BrickColor.new("Really black")
  46. MeshPart1.Material = Enum.Material.SmoothPlastic
  47. MeshPart1.Reflectance = 0.20000000298023
  48. MeshPart1.brickColor = BrickColor.new("Really black")
  49. MeshPart2.Name = "Blade"
  50. MeshPart2.Parent = Tool0
  51. 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)
  52. MeshPart2.Orientation = Vector3.new(0, 90, 90)
  53. MeshPart2.Position = Vector3.new(-6.01316595, 1.55946195, -11.8447742)
  54. MeshPart2.Rotation = Vector3.new(90, 90, 0)
  55. MeshPart2.Color = Color3.new(0.623529, 0.631373, 0.67451)
  56. MeshPart2.Size = Vector3.new(0.967115998, 0.232348993, 0.052695401)
  57. MeshPart2.BrickColor = BrickColor.new("Fossil")
  58. MeshPart2.Material = Enum.Material.Metal
  59. MeshPart2.Reflectance = 0.20000000298023
  60. MeshPart2.brickColor = BrickColor.new("Fossil")
  61. Motor6D3.Name = "Handle"
  62. Motor6D3.Parent = MeshPart2
  63. Motor6D3.C0 = CFrame.new(-0.91118902, 0.0624246597, 0.0059928894, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  64. Motor6D3.Part0 = MeshPart2
  65. Motor6D3.Part1 = MeshPart7
  66. Motor6D3.part1 = MeshPart7
  67. Motor6D4.Name = "latch"
  68. Motor6D4.Parent = MeshPart2
  69. Motor6D4.C0 = CFrame.new(-1.43141997, 0.0198984146, 0.0058221817, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  70. Motor6D4.Part0 = MeshPart2
  71. Motor6D4.Part1 = MeshPart6
  72. Motor6D4.part1 = MeshPart6
  73. Motor6D5.Name = "BiteHandle"
  74. Motor6D5.Parent = MeshPart2
  75. Motor6D5.C0 = CFrame.new(-0.911060989, -0.0735015869, 0.00602388382, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  76. Motor6D5.Part0 = MeshPart2
  77. Motor6D5.Part1 = MeshPart1
  78. Motor6D5.part1 = MeshPart1
  79. MeshPart6.Name = "latch"
  80. MeshPart6.Parent = Tool0
  81. 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)
  82. MeshPart6.Orientation = Vector3.new(0, 90, 90)
  83. MeshPart6.Position = Vector3.new(-6.00734377, 0.128041983, -11.8248758)
  84. MeshPart6.Rotation = Vector3.new(90, 90, 0)
  85. MeshPart6.Color = Color3.new(0.470588, 0.564706, 0.509804)
  86. MeshPart6.Size = Vector3.new(0.0714576989, 0.230782002, 0.052695401)
  87. MeshPart6.BrickColor = BrickColor.new("Sand green")
  88. MeshPart6.Material = Enum.Material.Metal
  89. MeshPart6.Reflectance = 0.20000000298023
  90. MeshPart6.brickColor = BrickColor.new("Sand green")
  91. MeshPart7.Name = "Handle"
  92. MeshPart7.Parent = Tool0
  93. 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)
  94. MeshPart7.Orientation = Vector3.new(0, 90, 90)
  95. MeshPart7.Position = Vector3.new(-6.00717306, 0.648272932, -11.7823496)
  96. MeshPart7.Rotation = Vector3.new(90, 90, 0)
  97. MeshPart7.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  98. MeshPart7.Size = Vector3.new(1.12040997, 0.119197004, 0.139892995)
  99. MeshPart7.BrickColor = BrickColor.new("Really black")
  100. MeshPart7.Material = Enum.Material.SmoothPlastic
  101. MeshPart7.Reflectance = 0.20000000298023
  102. MeshPart7.brickColor = BrickColor.new("Really black")
  103. for i,v in pairs(mas:GetChildren()) do
  104.     v.Parent = game:GetService("Players").LocalPlayer.Backpack
  105.     pcall(function() v:MakeJoints() end)
  106. end
  107. mas:Destroy()
  108. for i,v in pairs(cors) do
  109.     spawn(function()
  110.         pcall(v)
  111.     end)
  112. end
  113.  
  114.  
  115.  
  116. local r15 = false
  117.  
  118. local speed = 7--//AirMaxSpeed
  119. local fov = 100
  120.  
  121. --This part is being modified by Sincerate#3576,
  122. --just iniate an accelerated back hop
  123.  
  124.  
  125.  
  126. local c = workspace.Camera
  127.  
  128.  
  129. local FHumanoid = game:GetService("Players").LocalPlayer.Character.Humanoid
  130.  
  131. --//////==================================================\\\\\--
  132.  
  133. warn'bhop by pdnghiaqoi'
  134. local player
  135. local character
  136. local collider
  137. local camera
  138. local input
  139. local collider
  140. local playerGrounded
  141. local playerVelocity
  142. local jumping
  143. local moveInputSum
  144. local dt = 1/60
  145. local partYRatio
  146. local partZRatio
  147. local cameraYaw
  148. local cameraLook
  149. local movementPosition
  150. local movementVelocity
  151. local gravityForce
  152.  
  153. local airAccelerate
  154. local airMaxSpeed
  155. local groundAccelerate
  156. local groundMaxVelocity
  157. local friction
  158. local playerTorsoToGround
  159. local movementStickDistance
  160. local jumpVelocity
  161. local movementPositionForce
  162. local movementVelocityForce
  163. local maxMovementPitch
  164. local rayYLength
  165. local movementPositionD
  166. local movementPositionP
  167. local movementVelocityP
  168. local gravity
  169.  
  170.  
  171.  
  172. function init(Player, Camera, Input)
  173.     player = Player
  174.     character = player.Character
  175.     collider = character.HumanoidRootPart
  176.     camera = Camera
  177.     input = Input
  178.     playerVelocity = 0
  179.     playerGrounded = false
  180.     moveInputSum = {
  181.     ["forward"] = 0,
  182.     ["side"]    = 0 --left is positive
  183.     }
  184.    
  185.     airAccelerate           = 10000
  186.     airMaxSpeed             = speed
  187.     groundAccelerate        = 250
  188.     groundMaxVelocity       = 20
  189.     friction                = 10
  190.     playerTorsoToGround     = 3
  191.     movementStickDistance   = 0.5
  192.     jumpVelocity            = 52.5
  193.     movementPositionForce   = 400000
  194.     movementVelocityForce   = 300000
  195.     maxMovementPitch        = 0.6
  196.     rayYLength              = playerTorsoToGround + movementStickDistance
  197.     movementPositionD       = 125
  198.     movementPositionP       = 14000
  199.     movementVelocityP       = 1500
  200.     gravity                 = 0.4
  201.    
  202. end
  203.  
  204. function initBodyMovers()
  205.     movementPosition = Instance.new("BodyPosition", collider)
  206.     movementPosition.Name = "movementPosition"
  207.     movementPosition.D = movementPositionD
  208.     movementPosition.P = movementPositionP
  209.     movementPosition.maxForce = Vector3.new()
  210.     movementPosition.position = Vector3.new()
  211.    
  212.     movementVelocity = Instance.new("BodyVelocity", collider)
  213.     movementVelocity.Name = "movementVelocity"
  214.     movementVelocity.P = movementVelocityP
  215.     movementVelocity.maxForce = Vector3.new()
  216.     movementVelocity.velocity = Vector3.new()
  217.    
  218.     gravityForce = Instance.new("BodyForce", collider)
  219.     gravityForce.Name = "gravityForce"
  220.     gravityForce.force = Vector3.new(0, (1-gravity)*196.2, 0) * getCharacterMass()
  221. end
  222.  
  223. function update(deltaTime)
  224.     dt = deltaTime
  225.     updateMoveInputSum()
  226.     cameraYaw = getYaw()
  227.     cameraLook = cameraYaw.lookVector  
  228.     if cameraLook == nil then
  229.         return
  230.     end
  231.     local hitPart, hitPosition, hitNormal, yRatio, zRatio = findCollisionRay()
  232.     partYRatio = yRatio
  233.     partZRatio = zRatio
  234.    
  235.     playerGrounded = hitPart ~= nil and true or false
  236.     playerVelocity = collider.Velocity - Vector3.new(0, collider.Velocity.y, 0)
  237.     if playerGrounded and (input["Space"] or jumping) then
  238.         jumping = true
  239.     else
  240.         jumping = false
  241.     end
  242.    
  243.     setCharacterRotation()
  244.     if jumping then
  245.         jump()
  246.     elseif playerGrounded then
  247.         run(hitPosition)
  248.     else
  249.         air()      
  250.     end
  251.    
  252. end
  253.  
  254. function updateMoveInputSum()
  255.     moveInputSum["forward"] = input["W"] == true and 1 or 0
  256.     moveInputSum["forward"] = input["S"] == true and moveInputSum["forward"] - 1 or moveInputSum["forward"]
  257.     moveInputSum["side"] = input["A"] == true and 1 or 0
  258.     moveInputSum["side"] = input["D"] == true and moveInputSum["side"] - 1 or moveInputSum["side"]
  259. end
  260.  
  261. function findCollisionRay()
  262.     local torsoCFrame = character.HumanoidRootPart.CFrame
  263.     local ignoreList = {character, camera}
  264.     local rays = {
  265.         Ray.new(character.HumanoidRootPart.Position, Vector3.new(0, -rayYLength, 0)),
  266.         Ray.new((torsoCFrame * CFrame.new(-0.8,0,0)).p, Vector3.new(0, -rayYLength, 0)),
  267.         Ray.new((torsoCFrame * CFrame.new(0.8,0,0)).p, Vector3.new(0, -rayYLength, 0)),
  268.         Ray.new((torsoCFrame * CFrame.new(0,0,0.8)).p, Vector3.new(0, -rayYLength, 0)),
  269.         Ray.new((torsoCFrame * CFrame.new(0,0,-0.8)).p, Vector3.new(0, -rayYLength, 0))
  270.     }
  271.     local rayReturns  = {}
  272.    
  273.     local i
  274.     for i = 1, #rays do
  275.         local part, position, normal = game.Workspace:FindPartOnRayWithIgnoreList(rays[i],ignoreList)
  276.         if part == nil then
  277.             position = Vector3.new(0,-3000000,0)
  278.         end
  279.         if i == 1 then
  280.             table.insert(rayReturns, {part, position, normal})
  281.         else
  282.             local yPos = position.y
  283.             if yPos <= rayReturns[#rayReturns][2].y then
  284.                 table.insert(rayReturns, {part, position, normal})
  285.             else
  286.                 local j
  287.                 for j = 1, #rayReturns do
  288.                     if yPos >= rayReturns[j][2].y then
  289.                         table.insert(rayReturns, j, {part, position, normal})
  290.                     end
  291.                 end
  292.             end
  293.         end
  294.     end
  295.    
  296.     i = 1
  297.     local yRatio, zRatio = getPartYRatio(rayReturns[i][3])
  298.     while magnitude2D(yRatio, zRatio) > maxMovementPitch and i<#rayReturns do
  299.         i = i + 1
  300.         if rayReturns[i][1] then
  301.             yRatio, zRatio = getPartYRatio(rayReturns[i][3])
  302.         end
  303.     end
  304.    
  305.     return rayReturns[i][1], rayReturns[i][2], rayReturns[i][3], yRatio, zRatio
  306. end
  307.  
  308. function setCharacterRotation()
  309.     local rotationLook = collider.Position + camera.CoordinateFrame.lookVector
  310.     collider.CFrame = CFrame.new(collider.Position, Vector3.new(rotationLook.x, collider.Position.y, rotationLook.z))
  311.     collider.RotVelocity = Vector3.new()
  312. end
  313.  
  314. function jump()
  315.     collider.Velocity = Vector3.new(collider.Velocity.x, jumpVelocity, collider.Velocity.z)
  316.     air()
  317. end
  318.  
  319. function air()
  320.     movementPosition.maxForce = Vector3.new()
  321.     movementVelocity.velocity = getMovementVelocity(collider.Velocity, airAccelerate, airMaxSpeed)
  322.     movementVelocity.maxForce = getMovementVelocityAirForce()
  323. end
  324.  
  325. function run(hitPosition)
  326.     local playerSpeed = collider.Velocity.magnitude
  327.     local mVelocity = collider.Velocity
  328.    
  329.     if playerSpeed ~= 0 then
  330.         local drop = playerSpeed * friction * dt;
  331.         mVelocity = mVelocity * math.max(playerSpeed - drop, 0) / playerSpeed;
  332.     end
  333.    
  334.     movementPosition.position = hitPosition + Vector3.new(0,playerTorsoToGround,0)
  335.     movementPosition.maxForce = Vector3.new(0,movementPositionForce,0)
  336.     movementVelocity.velocity = getMovementVelocity(mVelocity, groundAccelerate, groundMaxVelocity)
  337.     local VelocityForce = getMovementVelocityForce()
  338.     movementVelocity.maxForce = VelocityForce
  339.     movementVelocity.P = movementVelocityP
  340. end
  341.  
  342. function getMovementVelocity(prevVelocity, accelerate, maxVelocity)
  343.     local accelForward = cameraLook * moveInputSum["forward"]
  344.     local accelSide = (cameraYaw * CFrame.Angles(0,math.rad(90),0)).lookVector * moveInputSum["side"];
  345.     local accelDir = (accelForward+accelSide).unit;
  346.     if moveInputSum["forward"] == 0 and moveInputSum["side"] == 0 then --avoids divide 0 errors
  347.         accelDir = Vector3.new(0,0,0);
  348.     end
  349.    
  350.     local projVel =  prevVelocity:Dot(accelDir);
  351.     local accelVel = accelerate * dt;
  352.    
  353.     if (projVel + accelVel > maxVelocity) then
  354.         accelVel = math.max(maxVelocity - projVel, 0);
  355.     end
  356.    
  357.     return prevVelocity + accelDir * accelVel;
  358. end
  359.  
  360. function getMovementVelocityForce()
  361.  
  362.     return Vector3.new(movementVelocityForce,0,movementVelocityForce)
  363. end
  364.  
  365. function getMovementVelocityAirForce()
  366.     local accelForward = cameraLook * moveInputSum["forward"];
  367.     local accelSide = (cameraYaw * CFrame.Angles(0,math.rad(90),0)).lookVector * moveInputSum["side"]
  368.     local accelDir = (accelForward+accelSide).unit
  369.     if moveInputSum["forward"] == 0 and moveInputSum["side"] == 0 then
  370.         accelDir = Vector3.new(0,0,0);
  371.     end
  372.    
  373.     local xp = math.abs(accelDir.x)
  374.     local zp = math.abs(accelDir.z)
  375.    
  376.     return Vector3.new(movementVelocityForce*xp,0,movementVelocityForce*zp)
  377. end
  378.  
  379. function getPartYRatio(normal)
  380.     local partYawVector = Vector3.new(-normal.x, 0, -normal.z)
  381.     if partYawVector.magnitude == 0 then
  382.         return 0,0
  383.     else
  384.         local partPitch = math.atan2(partYawVector.magnitude,normal.y)/(math.pi/2)
  385.         local vector = Vector3.new(cameraLook.x, 0, cameraLook.z)*partPitch
  386.         return vector:Dot(partYawVector), -partYawVector:Cross(vector).y
  387.     end
  388. end
  389.  
  390. function getYaw() --returns CFrame
  391.     return camera.CoordinateFrame*CFrame.Angles(-getPitch(),0,0)
  392. end
  393.  
  394. function getPitch() --returns number
  395.     return math.pi/2 - math.acos(camera.CoordinateFrame.lookVector:Dot(Vector3.new(0,1,0)))
  396. end
  397.  
  398. function getCharacterMass()
  399.     return character.HumanoidRootPart:GetMass() + character.Head:GetMass()
  400. end
  401.  
  402. function magnitude2D(x,z)
  403.     return math.sqrt(x*x+z*z)
  404. end
  405. local inputKeys = {
  406.     ["W"] = false,
  407.     ["S"] = false,
  408.     ["A"] = false,
  409.     ["D"] = false,
  410.     ["Space"] = false,
  411.     ["LMB"] = false,
  412.     ["RMB"] = false
  413. }
  414. local plr = game:GetService("Players").LocalPlayer
  415. script.Parent = plr.PlayerGui
  416. local camera = workspace.CurrentCamera
  417. local UserInputService = game:GetService("UserInputService")
  418. function onInput(input, gameProcessedEvent)
  419.     local inputState
  420.     --print(input.KeyCode)
  421.     if input.UserInputState == Enum.UserInputState.Begin then
  422.         inputState = true
  423.     elseif input.UserInputState == Enum.UserInputState.End then
  424.         inputState = false
  425.     else
  426.         return
  427.     end
  428.    
  429.     if input.UserInputType == Enum.UserInputType.Keyboard then
  430.         local key = input.KeyCode.Name
  431.         if inputKeys[key] ~= nil then
  432.             inputKeys[key] = inputState
  433.         end
  434.     elseif input.UserInputType == Enum.UserInputType.MouseButton1 then --LMB down
  435.         inputKeys.LMB = inputState
  436.     elseif input.UserInputType == Enum.UserInputType.MouseButton2 then --RMB down
  437.         inputKeys.RMB = inputState
  438.     end
  439. end
  440. function main()
  441.     local a = plr.Character:FindFirstChildOfClass("Humanoid") or plr.Character:WaitForChild("Humanoid");
  442.     a.PlatformStand = true
  443.     --init movement
  444.     init(plr, camera, inputKeys);
  445.     initBodyMovers();
  446.        
  447.     --connect input
  448.     UserInputService.InputBegan:connect(onInput);
  449.     UserInputService.InputEnded:connect(onInput);
  450.     --connect updateloop
  451.     game:GetService("RunService"):BindToRenderStep("updateLoop", 1, updateLoop);
  452.    
  453.     --rip
  454. end
  455.  
  456. local prevUpdateTime = nil
  457. local updateDT = 1/60
  458.  
  459. function setDeltaTime() --seconds
  460.     local UpdateTime = tick()
  461.     if prevUpdateTime ~= nil then
  462.         updateDT = (UpdateTime - prevUpdateTime)
  463.     else
  464.         updateDT = 1/60
  465.     end
  466.     prevUpdateTime = UpdateTime
  467. end
  468. function updateLoop()
  469.     setDeltaTime();
  470.     update(updateDT);
  471. end
  472. main()
  473.  
  474.  
  475. while true do
  476.     local mouseeeee = game.Players.LocalPlayer:GetMouse()
  477.     mouseeeee.Icon = "rbxassetid://330553538"
  478.     wait(0.1)
  479. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement