SHOW:
|
|
- or go back to the newest paste.
1 | -- This script has been converted to FE by iPxter | |
2 | ||
3 | ||
4 | - | local Player = Players.LocalPlayer |
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 | - | local Mouse = Player:GetMouse() |
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 | local Players = game:GetService("Players") | |
88 | local RunService = game:GetService("RunService") | |
89 | ||
90 | local Player = Players.Rohan_Kishiba | |
91 | local Camera = workspace.CurrentCamera | |
92 | local Camera = workspace.CurrentCamera | |
93 | local Character = Player.Character | |
94 | local Humanoid = Character:FindFirstChild("Humanoid") | |
95 | local Head = Character:FindFirstChild("Head") | |
96 | local Torso = Character:FindFirstChild("Torso") | |
97 | local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart") | |
98 | local RightArm = Character:FindFirstChild("Right Arm") | |
99 | local LeftArm = Character:FindFirstChild("Left Arm") | |
100 | local RightLeg = Character:FindFirstChild("Right Leg") | |
101 | local LeftLeg = Character:FindFirstChild("Left Leg") | |
102 | ||
103 | ||
104 | ||
105 | local Funcs = {} | |
106 | ||
107 | ||
108 | local Animation = "Standing" | |
109 | ||
110 | ||
111 | local charWelds = {} | |
112 | ||
113 | local Config = { | |
114 | standingSway = math.pi/45; | |
115 | walkingSway = math.pi/14; | |
116 | standingOffset = math.pi/80; | |
117 | walkingOffset = math.pi/48; | |
118 | } | |
119 | ||
120 | ||
121 | ||
122 | Humanoid.WalkSpeed = 22.4 | |
123 | Humanoid.JumpPower = 40 | |
124 | ||
125 | --Camera.CameraType = "Scriptable" | |
126 | ||
127 | ||
128 | ||
129 | ||
130 | charWelds.HumanoidRootPart = Instance.new("Weld", HumanoidRootPart) | |
131 | charWelds.HumanoidRootPart.Part0 = HumanoidRootPart | |
132 | charWelds.HumanoidRootPart.Part1 = Torso | |
133 | ||
134 | charWelds.rightArmWeld = Instance.new("Weld", Torso) | |
135 | charWelds.rightArmWeld.Part0 = Torso | |
136 | charWelds.rightArmWeld.Part1 = RightArm | |
137 | charWelds.rightArmWeld.C0 = CFrame.new(1.5, .5, 0) | |
138 | charWelds.rightArmWeld.C1 = CFrame.new(0, .5, 0) | |
139 | ||
140 | charWelds.leftArmWeld = Instance.new("Weld", Torso) | |
141 | charWelds.leftArmWeld.Part0 = Torso | |
142 | charWelds.leftArmWeld.Part1 = LeftArm | |
143 | charWelds.leftArmWeld.C0 = CFrame.new(-1.5, .5, 0) | |
144 | charWelds.leftArmWeld.C1 = CFrame.new(0, .5, 0) | |
145 | ||
146 | charWelds.rightLegWeld = Instance.new("Weld", Torso) | |
147 | charWelds.rightLegWeld.Part0 = Torso | |
148 | charWelds.rightLegWeld.Part1 = RightLeg | |
149 | charWelds.rightLegWeld.C0 = CFrame.new(.5, -1.5, 0) | |
150 | charWelds.rightLegWeld.C1 = CFrame.new(0, .5, 0) | |
151 | ||
152 | charWelds.leftLegWeld = Instance.new("Weld", Torso) | |
153 | charWelds.leftLegWeld.Part0 = Torso | |
154 | charWelds.leftLegWeld.Part1 = LeftLeg | |
155 | charWelds.leftLegWeld.C0 = CFrame.new(-.5, -1.5, 0) | |
156 | charWelds.leftLegWeld.C1 = CFrame.new(0, .5, 0) | |
157 | ||
158 | local Equipment = Instance.new("Folder", Character) | |
159 | ||
160 | ||
161 | ||
162 | ||
163 | function Funcs.CFrameInterpolate(oc, c, v) | |
164 | local oc1, oc2, oc3, oc4, oc5, oc6, oc7, oc8, oc9, oc10, oc11, oc12 = oc:components() | |
165 | local c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12 = c:components() | |
166 | return CFrame.new( | |
167 | oc1 + (c1 - oc1) * v, oc2 + (c2 - oc2) * v, oc3 + (c3 - oc3) * v, oc4 + (c4 - oc4) * v, oc5 + (c5 - oc5) * v, oc6 + (c6 - oc6) * v | |
168 | , oc7 + (c7 - oc7) * v, oc8 + (c8 - oc8) * v, oc9 + (c9 - oc9) * v, oc10 + (c10 - oc10) * v, oc11 + (c11 - oc11) * v, oc12 + (c12 - oc12) * v | |
169 | ) | |
170 | end | |
171 | ||
172 | function Funcs.Trail(p, c1, c2) | |
173 | local mag = (c2.p - c1.p).magnitude | |
174 | p.Size = Vector3.new(0, 0, mag) | |
175 | p.CFrame = CFrame.new(c1.p:Lerp(c2.p, 0.5)) | |
176 | p.CFrame = CFrame.new(p.CFrame.p, c2.p) | |
177 | end | |
178 | ||
179 | function Funcs.AngleInterpolate(w,c,x,y,z,x1,y1,z1,l) | |
180 | w.C1 = c * CFrame.fromEulerAnglesXYZ( | |
181 | x + math.sin(math.pi / 2 * l) * (x1 - x) | |
182 | , y + math.sin(math.pi / 2 * l) * (y1 - y) | |
183 | , z + math.sin(math.pi / 2 * l) * (z1 - z) | |
184 | ) | |
185 | end | |
186 | ||
187 | function Funcs.Part(Parent, t) | |
188 | local Part = Instance.new("Part", Parent) | |
189 | Part.BrickColor = t[2] | |
190 | Part.FormFactor = 3 | |
191 | Part.TopSurface, Part.BottomSurface, Part.LeftSurface, Part.RightSurface | |
192 | , Part.FrontSurface, Part.BackSurface = 10, 10, 10, 10, 10, 10 | |
193 | Part.CanCollide = t[1] | |
194 | Part.Transparency = t[3] | |
195 | Part.Material = t[4] | |
196 | Part.Reflectance = t[5] | |
197 | Part.Shape = t[6] | |
198 | Part.Size = t[7] | |
199 | return Part | |
200 | end | |
201 | ||
202 | function Funcs.BlockMesh(Part, Scale) | |
203 | local BlockMesh = Instance.new("BlockMesh", Part) | |
204 | BlockMesh.Scale = Scale | |
205 | return BlockMesh | |
206 | end | |
207 | ||
208 | function Funcs.CylinderMesh(Part, Scale) | |
209 | local CylinderMesh = Instance.new("CylinderMesh", Part) | |
210 | CylinderMesh.Scale = Scale | |
211 | return CylinderMesh | |
212 | end | |
213 | ||
214 | function Funcs.SpecialMesh(Part, Scale, MeshType) | |
215 | local SpecialMesh = Instance.new("SpecialMesh", Part) | |
216 | SpecialMesh.Scale = Scale | |
217 | SpecialMesh.MeshType = MeshType | |
218 | return SpecialMesh | |
219 | end | |
220 | ||
221 | function Funcs.Weld(Part0, Part1, C0) | |
222 | local Weld = Instance.new("Weld", Part0) | |
223 | Weld.Part0, Weld.Part1, Weld.C0 = Part0, Part1, C0 | |
224 | return Weld | |
225 | end | |
226 | ||
227 | function Funcs.AddEquipment() | |
228 | ||
229 | Whip = Funcs.Part(Equipment, {true, BrickColor.new("Brown"), 0, Enum.Material.SmoothPlastic, 0, Enum.PartType.Block, Vector3.new(0.2, 0.2, 1.6)}) | |
230 | local WhipWeld = Funcs.Weld(RightArm, Whip, CFrame.new(0, -1.1, -0.6)) | |
231 | ||
232 | Rope = Funcs.Part(Equipment, {false, BrickColor.new("Really black"), 0, Enum.Material.SmoothPlastic, 0, Enum.PartType.Block, Vector3.new(0, 0, 1)}) | |
233 | local RopeMesh = Funcs.BlockMesh(Rope, Vector3.new(0.4, 0.4, 1)) | |
234 | Rope.Anchored = true | |
235 | ||
236 | RopeE = Funcs.Part(Equipment, {false, BrickColor.new("Dark stone grey"), 0, Enum.Material.SmoothPlastic, 0, Enum.PartType.Block, Vector3.new(0, 0, 0)}) | |
237 | local RopeEMesh = Funcs.SpecialMesh(RopeE, Vector3.new(0.8, 0.8, 0.8), "Sphere") | |
238 | RopeE.Anchored = true | |
239 | ||
240 | end | |
241 | ||
242 | local ropeEnd = CFrame.new(0, 0, 0) | |
243 | ||
244 | function Funcs.Whip() | |
245 | if Animation ~= "Throwing" then | |
246 | Animation = "Throwing" | |
247 | ||
248 | for i = 0, 1, 0.1 do | |
249 | Funcs.AngleInterpolate(charWelds.HumanoidRootPart, CFrame.new(0, 0, 0) | |
250 | , 0, 0, 0, 0, math.pi / 8, 0, i) | |
251 | Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0) | |
252 | , 0, 0, -math.pi / 8, -math.pi * 5 / 4, 0, math.pi / 12, i) | |
253 | wait() | |
254 | end | |
255 | ||
256 | local targ = Mouse.Target | |
257 | local cf = Mouse.Hit | |
258 | ||
259 | for i = 0, 1, 0.2 do | |
260 | Funcs.AngleInterpolate(charWelds.HumanoidRootPart, CFrame.new(0, 0, 0) | |
261 | , 0, math.pi / 8, 0, 0, 0, 0, i) | |
262 | Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0) | |
263 | , -math.pi * 5 / 4, 0, math.pi / 8, 0, 0, -math.pi / 12, i) | |
264 | wait() | |
265 | end | |
266 | ||
267 | if (Torso.Position - cf.p).magnitude < 120 then | |
268 | ropeEnd = cf | |
269 | ||
270 | wait(1 / 2) | |
271 | if targ and targ.Parent and targ.Parent:FindFirstChild("Humanoid") then | |
272 | targ.Parent:BreakJoints() | |
273 | end | |
274 | ||
275 | ropeEnd = Whip.CFrame * CFrame.new(0, -1.8, -0.7) | |
276 | end | |
277 | ||
278 | Animation = "Standing" | |
279 | end | |
280 | end | |
281 | ||
282 | local Snd = Instance.new("Sound", Torso) | |
283 | Snd.SoundId = "rbxassetid://163277488" | |
284 | Snd.Volume = 100 | |
285 | ||
286 | Mouse.Button1Down:connect(function() | |
287 | Snd:Play() | |
288 | Funcs.Whip() | |
289 | end) | |
290 | ||
291 | ||
292 | Funcs.AddEquipment() | |
293 | ||
294 | local i = 0 | |
295 | local camGoal = Head.CFrame | |
296 | local ropeCEnd = RightArm.CFrame | |
297 | ropeEnd = Whip.CFrame * CFrame.new(0, -1.8, -0.7) | |
298 | ||
299 | ||
300 | RunService.Stepped:connect(function() | |
301 | ||
302 | ||
303 | local animSpeed = 0.02 | |
304 | local offsetMultiplier = 1 | |
305 | ||
306 | ||
307 | local ropeStart = Whip.CFrame * CFrame.new(0, 0, -0.7) | |
308 | ropeCEnd = CFrame.new(ropeCEnd.p:Lerp(ropeEnd.p, 0.2)) | |
309 | RopeE.CFrame = ropeCEnd | |
310 | if Animation ~= "Throwing" then | |
311 | ropeEnd = Whip.CFrame * CFrame.new(0, -1.8, -0.7) | |
312 | end | |
313 | ||
314 | Funcs.Trail(Rope, ropeStart, ropeCEnd) | |
315 | ||
316 | ||
317 | ||
318 | if Humanoid.Jump == true then | |
319 | if Animation ~= "Throwing" then | |
320 | Animation = "Jumping" | |
321 | ||
322 | end | |
323 | animSpeed = 0.001 | |
324 | offsetMultiplier = 3 | |
325 | elseif Torso.Velocity.magnitude > 0.4 then | |
326 | if Animation ~= "Throwing" then | |
327 | Animation = "Walking" | |
328 | end | |
329 | animSpeed = 0.1 | |
330 | offsetMultiplier = 1 | |
331 | else | |
332 | if Animation ~= "Throwing" then | |
333 | Animation = "Standing" | |
334 | end | |
335 | animSpeed = 0.02 | |
336 | offsetMultiplier = 1 | |
337 | end | |
338 | ||
339 | ||
340 | if i < 2 then | |
341 | i = i + animSpeed | |
342 | else | |
343 | i = 0 | |
344 | end | |
345 | ||
346 | ||
347 | if Animation == "Standing" or Animation == "Throwing" then | |
348 | if i < 1 then | |
349 | if Animation ~= "Throwing" then | |
350 | Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0) | |
351 | , Config.standingSway, 0, -Config.standingOffset * offsetMultiplier, -Config.standingSway, 0, -Config.standingOffset * offsetMultiplier, i) | |
352 | end | |
353 | Funcs.AngleInterpolate(charWelds.leftArmWeld, CFrame.new(0,.5,0) | |
354 | , -Config.standingSway, 0, Config.standingOffset * offsetMultiplier, Config.standingSway, 0, Config.standingOffset * offsetMultiplier, i) | |
355 | Funcs.AngleInterpolate(charWelds.leftLegWeld, CFrame.new(0,.5,0) | |
356 | , Config.standingSway, 0, Config.standingOffset * offsetMultiplier / 2, -Config.standingSway, 0, Config.standingOffset * offsetMultiplier / 2, i) | |
357 | Funcs.AngleInterpolate(charWelds.rightLegWeld, CFrame.new(0,.5,0) | |
358 | , -Config.standingSway, 0, -Config.standingOffset * offsetMultiplier / 2, Config.standingSway, 0, -Config.standingOffset * offsetMultiplier / 2, i) | |
359 | elseif i >= 1 then | |
360 | if Animation ~= "Throwing" then | |
361 | Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0) | |
362 | , -Config.standingSway, 0, -Config.standingOffset * offsetMultiplier, Config.standingSway, 0, -Config.standingOffset * offsetMultiplier, i - 1) | |
363 | end | |
364 | Funcs.AngleInterpolate(charWelds.leftArmWeld, CFrame.new(0,.5,0) | |
365 | , Config.standingSway, 0, Config.standingOffset * offsetMultiplier, -Config.standingSway, 0, Config.standingOffset * offsetMultiplier, i - 1) | |
366 | Funcs.AngleInterpolate(charWelds.leftLegWeld, CFrame.new(0,.5,0) | |
367 | , -Config.standingSway, 0, Config.standingOffset * offsetMultiplier / 2, Config.standingSway, 0, Config.standingOffset * offsetMultiplier / 2, i - 1) | |
368 | Funcs.AngleInterpolate(charWelds.rightLegWeld, CFrame.new(0,.5,0) | |
369 | , Config.standingSway, 0, -Config.standingOffset * offsetMultiplier / 2, -Config.standingSway, 0, -Config.standingOffset * offsetMultiplier / 2, i - 1) | |
370 | end | |
371 | end | |
372 | if Animation == "Walking" or Animation == "Jumping" or Animation == "Throwing" or Animation == "Shooting" then | |
373 | if i < 1 then | |
374 | if Animation ~= "Throwing" then | |
375 | Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0) | |
376 | , Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier, -Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier, i) | |
377 | end | |
378 | Funcs.AngleInterpolate(charWelds.leftArmWeld, CFrame.new(0,.5,0) | |
379 | , -Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier, Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier, i) | |
380 | Funcs.AngleInterpolate(charWelds.leftLegWeld, CFrame.new(0,.5,0) | |
381 | , Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier / 2, -Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier / 2, i) | |
382 | Funcs.AngleInterpolate(charWelds.rightLegWeld, CFrame.new(0,.5,0) | |
383 | , -Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier / 2, Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier / 2, i) | |
384 | elseif i >= 1 then | |
385 | if Animation ~= "Throwing" then | |
386 | Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0) | |
387 | , -Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier, Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier, i - 1) | |
388 | end | |
389 | Funcs.AngleInterpolate(charWelds.leftArmWeld, CFrame.new(0,.5,0) | |
390 | , Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier, -Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier, i - 1) | |
391 | Funcs.AngleInterpolate(charWelds.leftLegWeld, CFrame.new(0,.5,0) | |
392 | , -Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier / 2, Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier / 2, i - 1) | |
393 | Funcs.AngleInterpolate(charWelds.rightLegWeld, CFrame.new(0,.5,0) | |
394 | , Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier / 2, -Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier / 2, i - 1) | |
395 | end | |
396 | end | |
397 | ||
398 | end) |