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