yoinkydoodlewastaken

WHIPP

Jul 2nd, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- This script has been converted to FE by iPxter
  2.  
  3.  
  4. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  5. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  6. do
  7. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  8. script.Parent = Player.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent and t.Function then
  34. t.Function(...)
  35. end
  36. end
  37. m.TrigEvent = te
  38. UIS.TrigEvent = te
  39.  
  40. Event.OnServerEvent:Connect(function(plr,io)
  41. if plr~=Player then return end
  42. if io.isMouse then
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. else
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. for _,t in pairs(CAS.Actions) do
  51. for _,k in pairs(t.Keys) do
  52. if k==io.KeyCode then
  53. t.Function(t.Name,io.UserInputState,io)
  54. end
  55. end
  56. end
  57. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  58. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  59. end
  60. end)
  61. Event.Parent = NLS([==[
  62. local Player = game:GetService("Players").Rohan_Kishiba
  63. local Event = script:WaitForChild("UserInput_Event")
  64.  
  65. local UIS = game:GetService("UserInputService")
  66. local input = function(io,a)
  67. if a then return end
  68. --Since InputObject is a client-side instance, we create and pass table instead
  69. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  70. end
  71. UIS.InputBegan:Connect(input)
  72. UIS.InputEnded:Connect(input)
  73.  
  74. local Mouse = Player:GetMouse()
  75. local h,t
  76. --Give the server mouse data 30 times every second, but only if the values changed
  77. --If player is not moving their mouse, client won't fire events
  78. while wait(1/30) do
  79. if h~=Mouse.Hit or t~=Mouse.Target then
  80. h,t=Mouse.Hit,Mouse.Target
  81. Event:FireServer({isMouse=true,Target=t,Hit=h})
  82. end
  83. end]==],Player.Character)
  84. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  85. end
  86.  
  87.  
  88. local Player = game:GetService("Players").Rohan_Kishiba
  89. local Camera = workspace.CurrentCamera
  90. local Camera = workspace.CurrentCamera
  91. local Character = Player.Character
  92. local Humanoid = Character:FindFirstChild("Humanoid")
  93. local Head = Character:FindFirstChild("Head")
  94. local Torso = Character:FindFirstChild("Torso")
  95. local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
  96. local RightArm = Character:FindFirstChild("Right Arm")
  97. local LeftArm = Character:FindFirstChild("Left Arm")
  98. local RightLeg = Character:FindFirstChild("Right Leg")
  99. local LeftLeg = Character:FindFirstChild("Left Leg")
  100.  
  101.  
  102.  
  103. local Funcs = {}
  104.  
  105.  
  106. local Animation = "Standing"
  107.  
  108.  
  109. local charWelds = {}
  110.  
  111. local Config = {
  112. standingSway = math.pi/45;
  113. walkingSway = math.pi/14;
  114. standingOffset = math.pi/80;
  115. walkingOffset = math.pi/48;
  116. }
  117.  
  118.  
  119.  
  120. Humanoid.WalkSpeed = 22.4
  121. Humanoid.JumpPower = 40
  122.  
  123. --Camera.CameraType = "Scriptable"
  124.  
  125.  
  126.  
  127.  
  128. charWelds.HumanoidRootPart = Instance.new("Weld", HumanoidRootPart)
  129. charWelds.HumanoidRootPart.Part0 = HumanoidRootPart
  130. charWelds.HumanoidRootPart.Part1 = Torso
  131.  
  132. charWelds.rightArmWeld = Instance.new("Weld", Torso)
  133. charWelds.rightArmWeld.Part0 = Torso
  134. charWelds.rightArmWeld.Part1 = RightArm
  135. charWelds.rightArmWeld.C0 = CFrame.new(1.5, .5, 0)
  136. charWelds.rightArmWeld.C1 = CFrame.new(0, .5, 0)
  137.  
  138. charWelds.leftArmWeld = Instance.new("Weld", Torso)
  139. charWelds.leftArmWeld.Part0 = Torso
  140. charWelds.leftArmWeld.Part1 = LeftArm
  141. charWelds.leftArmWeld.C0 = CFrame.new(-1.5, .5, 0)
  142. charWelds.leftArmWeld.C1 = CFrame.new(0, .5, 0)
  143.  
  144. charWelds.rightLegWeld = Instance.new("Weld", Torso)
  145. charWelds.rightLegWeld.Part0 = Torso
  146. charWelds.rightLegWeld.Part1 = RightLeg
  147. charWelds.rightLegWeld.C0 = CFrame.new(.5, -1.5, 0)
  148. charWelds.rightLegWeld.C1 = CFrame.new(0, .5, 0)
  149.  
  150. charWelds.leftLegWeld = Instance.new("Weld", Torso)
  151. charWelds.leftLegWeld.Part0 = Torso
  152. charWelds.leftLegWeld.Part1 = LeftLeg
  153. charWelds.leftLegWeld.C0 = CFrame.new(-.5, -1.5, 0)
  154. charWelds.leftLegWeld.C1 = CFrame.new(0, .5, 0)
  155.  
  156. local Equipment = Instance.new("Folder", Character)
  157.  
  158.  
  159.  
  160.  
  161. function Funcs.CFrameInterpolate(oc, c, v)
  162. local oc1, oc2, oc3, oc4, oc5, oc6, oc7, oc8, oc9, oc10, oc11, oc12 = oc:components()
  163. local c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12 = c:components()
  164. return CFrame.new(
  165. oc1 + (c1 - oc1) * v, oc2 + (c2 - oc2) * v, oc3 + (c3 - oc3) * v, oc4 + (c4 - oc4) * v, oc5 + (c5 - oc5) * v, oc6 + (c6 - oc6) * v
  166. , oc7 + (c7 - oc7) * v, oc8 + (c8 - oc8) * v, oc9 + (c9 - oc9) * v, oc10 + (c10 - oc10) * v, oc11 + (c11 - oc11) * v, oc12 + (c12 - oc12) * v
  167. )
  168. end
  169.  
  170. function Funcs.Trail(p, c1, c2)
  171. local mag = (c2.p - c1.p).magnitude
  172. p.Size = Vector3.new(0, 0, mag)
  173. p.CFrame = CFrame.new(c1.p:Lerp(c2.p, 0.5))
  174. p.CFrame = CFrame.new(p.CFrame.p, c2.p)
  175. end
  176.  
  177. function Funcs.AngleInterpolate(w,c,x,y,z,x1,y1,z1,l)
  178. w.C1 = c * CFrame.fromEulerAnglesXYZ(
  179. x + math.sin(math.pi / 2 * l) * (x1 - x)
  180. , y + math.sin(math.pi / 2 * l) * (y1 - y)
  181. , z + math.sin(math.pi / 2 * l) * (z1 - z)
  182. )
  183. end
  184.  
  185. function Funcs.Part(Parent, t)
  186. local Part = Instance.new("Part", Parent)
  187. Part.BrickColor = t[2]
  188. Part.FormFactor = 3
  189. Part.TopSurface, Part.BottomSurface, Part.LeftSurface, Part.RightSurface
  190. , Part.FrontSurface, Part.BackSurface = 10, 10, 10, 10, 10, 10
  191. Part.CanCollide = t[1]
  192. Part.Transparency = t[3]
  193. Part.Material = t[4]
  194. Part.Reflectance = t[5]
  195. Part.Shape = t[6]
  196. Part.Size = t[7]
  197. return Part
  198. end
  199.  
  200. function Funcs.BlockMesh(Part, Scale)
  201. local BlockMesh = Instance.new("BlockMesh", Part)
  202. BlockMesh.Scale = Scale
  203. return BlockMesh
  204. end
  205.  
  206. function Funcs.CylinderMesh(Part, Scale)
  207. local CylinderMesh = Instance.new("CylinderMesh", Part)
  208. CylinderMesh.Scale = Scale
  209. return CylinderMesh
  210. end
  211.  
  212. function Funcs.SpecialMesh(Part, Scale, MeshType)
  213. local SpecialMesh = Instance.new("SpecialMesh", Part)
  214. SpecialMesh.Scale = Scale
  215. SpecialMesh.MeshType = MeshType
  216. return SpecialMesh
  217. end
  218.  
  219. function Funcs.Weld(Part0, Part1, C0)
  220. local Weld = Instance.new("Weld", Part0)
  221. Weld.Part0, Weld.Part1, Weld.C0 = Part0, Part1, C0
  222. return Weld
  223. end
  224.  
  225. function Funcs.AddEquipment()
  226.  
  227. Whip = Funcs.Part(Equipment, {true, BrickColor.new("Brown"), 0, Enum.Material.SmoothPlastic, 0, Enum.PartType.Block, Vector3.new(0.2, 0.2, 1.6)})
  228. local WhipWeld = Funcs.Weld(RightArm, Whip, CFrame.new(0, -1.1, -0.6))
  229.  
  230. Rope = Funcs.Part(Equipment, {false, BrickColor.new("Really black"), 0, Enum.Material.SmoothPlastic, 0, Enum.PartType.Block, Vector3.new(0, 0, 1)})
  231. local RopeMesh = Funcs.BlockMesh(Rope, Vector3.new(0.4, 0.4, 1))
  232. Rope.Anchored = true
  233.  
  234. RopeE = Funcs.Part(Equipment, {false, BrickColor.new("Dark stone grey"), 0, Enum.Material.SmoothPlastic, 0, Enum.PartType.Block, Vector3.new(0, 0, 0)})
  235. local RopeEMesh = Funcs.SpecialMesh(RopeE, Vector3.new(0.8, 0.8, 0.8), "Sphere")
  236. RopeE.Anchored = true
  237.  
  238. end
  239.  
  240. local ropeEnd = CFrame.new(0, 0, 0)
  241.  
  242. function Funcs.Whip()
  243. if Animation ~= "Throwing" then
  244. Animation = "Throwing"
  245.  
  246. for i = 0, 1, 0.1 do
  247. Funcs.AngleInterpolate(charWelds.HumanoidRootPart, CFrame.new(0, 0, 0)
  248. , 0, 0, 0, 0, math.pi / 8, 0, i)
  249. Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0)
  250. , 0, 0, -math.pi / 8, -math.pi * 5 / 4, 0, math.pi / 12, i)
  251. wait()
  252. end
  253.  
  254. local targ = Mouse.Target
  255. local cf = Mouse.Hit
  256.  
  257. for i = 0, 1, 0.2 do
  258. Funcs.AngleInterpolate(charWelds.HumanoidRootPart, CFrame.new(0, 0, 0)
  259. , 0, math.pi / 8, 0, 0, 0, 0, i)
  260. Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0)
  261. , -math.pi * 5 / 4, 0, math.pi / 8, 0, 0, -math.pi / 12, i)
  262. wait()
  263. end
  264.  
  265. if (Torso.Position - cf.p).magnitude < 120 then
  266. ropeEnd = cf
  267.  
  268. wait(1 / 2)
  269. if targ and targ.Parent and targ.Parent:FindFirstChild("Humanoid") then
  270. targ.Parent:BreakJoints()
  271. end
  272.  
  273. ropeEnd = Whip.CFrame * CFrame.new(0, -1.8, -0.7)
  274. end
  275.  
  276. Animation = "Standing"
  277. end
  278. end
  279.  
  280. local Snd = Instance.new("Sound", Torso)
  281. Snd.SoundId = "rbxassetid://163277488"
  282. Snd.Volume = 100
  283.  
  284. Mouse.Button1Down:connect(function()
  285. Snd:Play()
  286. Funcs.Whip()
  287. end)
  288.  
  289.  
  290. Funcs.AddEquipment()
  291.  
  292. local i = 0
  293. local camGoal = Head.CFrame
  294. local ropeCEnd = RightArm.CFrame
  295. ropeEnd = Whip.CFrame * CFrame.new(0, -1.8, -0.7)
  296.  
  297.  
  298. RunService.Stepped:connect(function()
  299.  
  300.  
  301. local animSpeed = 0.02
  302. local offsetMultiplier = 1
  303.  
  304.  
  305. local ropeStart = Whip.CFrame * CFrame.new(0, 0, -0.7)
  306. ropeCEnd = CFrame.new(ropeCEnd.p:Lerp(ropeEnd.p, 0.2))
  307. RopeE.CFrame = ropeCEnd
  308. if Animation ~= "Throwing" then
  309. ropeEnd = Whip.CFrame * CFrame.new(0, -1.8, -0.7)
  310. end
  311.  
  312. Funcs.Trail(Rope, ropeStart, ropeCEnd)
  313.  
  314.  
  315.  
  316. if Humanoid.Jump == true then
  317. if Animation ~= "Throwing" then
  318. Animation = "Jumping"
  319.  
  320. end
  321. animSpeed = 0.001
  322. offsetMultiplier = 3
  323. elseif Torso.Velocity.magnitude > 0.4 then
  324. if Animation ~= "Throwing" then
  325. Animation = "Walking"
  326. end
  327. animSpeed = 0.1
  328. offsetMultiplier = 1
  329. else
  330. if Animation ~= "Throwing" then
  331. Animation = "Standing"
  332. end
  333. animSpeed = 0.02
  334. offsetMultiplier = 1
  335. end
  336.  
  337.  
  338. if i < 2 then
  339. i = i + animSpeed
  340. else
  341. i = 0
  342. end
  343.  
  344.  
  345. if Animation == "Standing" or Animation == "Throwing" then
  346. if i < 1 then
  347. if Animation ~= "Throwing" then
  348. Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0)
  349. , Config.standingSway, 0, -Config.standingOffset * offsetMultiplier, -Config.standingSway, 0, -Config.standingOffset * offsetMultiplier, i)
  350. end
  351. Funcs.AngleInterpolate(charWelds.leftArmWeld, CFrame.new(0,.5,0)
  352. , -Config.standingSway, 0, Config.standingOffset * offsetMultiplier, Config.standingSway, 0, Config.standingOffset * offsetMultiplier, i)
  353. Funcs.AngleInterpolate(charWelds.leftLegWeld, CFrame.new(0,.5,0)
  354. , Config.standingSway, 0, Config.standingOffset * offsetMultiplier / 2, -Config.standingSway, 0, Config.standingOffset * offsetMultiplier / 2, i)
  355. Funcs.AngleInterpolate(charWelds.rightLegWeld, CFrame.new(0,.5,0)
  356. , -Config.standingSway, 0, -Config.standingOffset * offsetMultiplier / 2, Config.standingSway, 0, -Config.standingOffset * offsetMultiplier / 2, i)
  357. elseif i >= 1 then
  358. if Animation ~= "Throwing" then
  359. Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0)
  360. , -Config.standingSway, 0, -Config.standingOffset * offsetMultiplier, Config.standingSway, 0, -Config.standingOffset * offsetMultiplier, i - 1)
  361. end
  362. Funcs.AngleInterpolate(charWelds.leftArmWeld, CFrame.new(0,.5,0)
  363. , Config.standingSway, 0, Config.standingOffset * offsetMultiplier, -Config.standingSway, 0, Config.standingOffset * offsetMultiplier, i - 1)
  364. Funcs.AngleInterpolate(charWelds.leftLegWeld, CFrame.new(0,.5,0)
  365. , -Config.standingSway, 0, Config.standingOffset * offsetMultiplier / 2, Config.standingSway, 0, Config.standingOffset * offsetMultiplier / 2, i - 1)
  366. Funcs.AngleInterpolate(charWelds.rightLegWeld, CFrame.new(0,.5,0)
  367. , Config.standingSway, 0, -Config.standingOffset * offsetMultiplier / 2, -Config.standingSway, 0, -Config.standingOffset * offsetMultiplier / 2, i - 1)
  368. end
  369. end
  370. if Animation == "Walking" or Animation == "Jumping" or Animation == "Throwing" or Animation == "Shooting" then
  371. if i < 1 then
  372. if Animation ~= "Throwing" then
  373. Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0)
  374. , Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier, -Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier, i)
  375. end
  376. Funcs.AngleInterpolate(charWelds.leftArmWeld, CFrame.new(0,.5,0)
  377. , -Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier, Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier, i)
  378. Funcs.AngleInterpolate(charWelds.leftLegWeld, CFrame.new(0,.5,0)
  379. , Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier / 2, -Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier / 2, i)
  380. Funcs.AngleInterpolate(charWelds.rightLegWeld, CFrame.new(0,.5,0)
  381. , -Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier / 2, Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier / 2, i)
  382. elseif i >= 1 then
  383. if Animation ~= "Throwing" then
  384. Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0)
  385. , -Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier, Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier, i - 1)
  386. end
  387. Funcs.AngleInterpolate(charWelds.leftArmWeld, CFrame.new(0,.5,0)
  388. , Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier, -Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier, i - 1)
  389. Funcs.AngleInterpolate(charWelds.leftLegWeld, CFrame.new(0,.5,0)
  390. , -Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier / 2, Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier / 2, i - 1)
  391. Funcs.AngleInterpolate(charWelds.rightLegWeld, CFrame.new(0,.5,0)
  392. , Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier / 2, -Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier / 2, i - 1)
  393. end
  394. end
  395.  
  396. end)
Add Comment
Please, Sign In to add comment