SHOW:
|
|
- or go back to the newest paste.
1 | --https://github.com/Mokiros/roblox-FE-compatibility | |
2 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end | |
3 | local Player,game,owner = owner,game | |
4 | local RealPlayer = Player | |
5 | do | |
6 | print("FE Compatibility code V2 by Mokiros") | |
7 | local RealPlayer = RealPlayer | |
8 | script.Parent = RealPlayer.Character | |
9 | ||
10 | --Fake event to make stuff like Mouse.KeyDown work | |
11 | local Disconnect_Function = function(this) | |
12 | this[1].Functions[this[2]] = nil | |
13 | end | |
14 | local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}} | |
15 | local FakeEvent_Metatable = {__index={ | |
16 | Connect = function(this,f) | |
17 | local i = tostring(math.random(0,10000)) | |
18 | while this.Functions[i] do | |
19 | i = tostring(math.random(0,10000)) | |
20 | end | |
21 | this.Functions[i] = f | |
22 | return setmetatable({this,i},Disconnect_Metatable) | |
23 | end | |
24 | }} | |
25 | FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect | |
26 | local function fakeEvent() | |
27 | return setmetatable({Functions={}},FakeEvent_Metatable) | |
28 | end | |
29 | ||
30 | --Creating fake input objects with fake variables | |
31 | local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()} | |
32 | FakeMouse.keyUp = FakeMouse.KeyUp | |
33 | FakeMouse.keyDown = FakeMouse.KeyDown | |
34 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()} | |
35 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...) | |
36 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil | |
37 | end} | |
38 | --Merged 2 functions into one by checking amount of arguments | |
39 | CAS.UnbindAction = CAS.BindAction | |
40 | ||
41 | --This function will trigger the events that have been :Connect()'ed | |
42 | local function TriggerEvent(self,ev,...) | |
43 | for _,f in pairs(self[ev].Functions) do | |
44 | f(...) | |
45 | end | |
46 | end | |
47 | FakeMouse.TriggerEvent = TriggerEvent | |
48 | UIS.TriggerEvent = TriggerEvent | |
49 | ||
50 | --Client communication | |
51 | local Event = Instance.new("RemoteEvent") | |
52 | Event.Name = "UserInput_Event" | |
53 | Event.OnServerEvent:Connect(function(plr,io) | |
54 | if plr~=RealPlayer then return end | |
55 | FakeMouse.Target = io.Target | |
56 | FakeMouse.Hit = io.Hit | |
57 | if not io.isMouse then | |
58 | local b = io.UserInputState == Enum.UserInputState.Begin | |
59 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
60 | return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up") | |
61 | end | |
62 | if io.UserInputType == Enum.UserInputType.MouseButton2 then | |
63 | return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up") | |
64 | end | |
65 | for _,t in pairs(CAS.Actions) do | |
66 | for _,k in pairs(t.Keys) do | |
67 | if k==io.KeyCode then | |
68 | t.Function(t.Name,io.UserInputState,io) | |
69 | end | |
70 | end | |
71 | end | |
72 | FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
73 | UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false) | |
74 | end | |
75 | end) | |
76 | Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event") | |
77 | local Mouse = owner:GetMouse() | |
78 | local UIS = game:GetService("UserInputService") | |
79 | local input = function(io,RobloxHandled) | |
80 | if RobloxHandled then return end | |
81 | --Since InputObject is a client-side instance, we create and pass table instead | |
82 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target}) | |
83 | end | |
84 | UIS.InputBegan:Connect(input) | |
85 | UIS.InputEnded:Connect(input) | |
86 | local h,t | |
87 | --Give the server mouse data every second frame, but only if the values changed | |
88 | --If player is not moving their mouse, client won't fire events | |
89 | local HB = game:GetService("RunService").Heartbeat | |
90 | while true do | |
91 | if h~=Mouse.Hit or t~=Mouse.Target then | |
92 | h,t=Mouse.Hit,Mouse.Target | |
93 | Event:FireServer({isMouse=true,Target=t,Hit=h}) | |
94 | end | |
95 | --Wait 2 frames | |
96 | for i=1,2 do | |
97 | HB:Wait() | |
98 | end | |
99 | end]==],script) | |
100 | ||
101 | ----Sandboxed game object that allows the usage of client-side methods and services | |
102 | --Real game object | |
103 | local RealGame = game | |
104 | ||
105 | --Metatable for fake service | |
106 | local FakeService_Metatable = { | |
107 | __index = function(self,k) | |
108 | local s = rawget(self,"_RealService") | |
109 | if s then | |
110 | return typeof(s[k])=="function" | |
111 | and function(_,...)return s[k](s,...)end or s[k] | |
112 | end | |
113 | end, | |
114 | __newindex = function(self,k,v) | |
115 | local s = rawget(self,"_RealService") | |
116 | if s then s[k]=v end | |
117 | end | |
118 | } | |
119 | local function FakeService(t,RealService) | |
120 | t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService | |
121 | return setmetatable(t,FakeService_Metatable) | |
122 | end | |
123 | ||
124 | --Fake game object | |
125 | local FakeGame = { | |
126 | GetService = function(self,s) | |
127 | return rawget(self,s) or RealGame:GetService(s) | |
128 | end, | |
129 | Players = FakeService({ | |
130 | LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player) | |
131 | },"Players"), | |
132 | UserInputService = FakeService(UIS,"UserInputService"), | |
133 | ContextActionService = FakeService(CAS,"ContextActionService"), | |
134 | RunService = FakeService({ | |
135 | _btrs = {}, | |
136 | RenderStepped = RealGame:GetService("RunService").Heartbeat, | |
137 | BindToRenderStep = function(self,name,_,fun) | |
138 | self._btrs[name] = self.Heartbeat:Connect(fun) | |
139 | end, | |
140 | UnbindFromRenderStep = function(self,name) | |
141 | self._btrs[name]:Disconnect() | |
142 | end, | |
143 | },"RunService") | |
144 | } | |
145 | rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer) | |
146 | FakeGame.service = FakeGame.GetService | |
147 | FakeService(FakeGame,game) | |
148 | --Changing owner to fake player object to support owner:GetMouse() | |
149 | game,owner = FakeGame,FakeGame.Players.LocalPlayer | |
150 | end | |
151 | -- Services -- | |
152 | local Player = game:GetService("Players").LocalPlayer | |
153 | local RunService = game:GetService("RunService") | |
154 | local InputService = game:GetService("UserInputService") | |
155 | local ChatService = game:GetService("Chat") | |
156 | local Mouse = Player:GetMouse() | |
157 | -- Variables -- | |
158 | local Character = Player.Character | |
159 | local Torso = Character.Torso | |
160 | local Head = Character.Head | |
161 | local HammerHandleWeld = Character.HumanoidRootPart | |
162 | local Humanoid = Character:FindFirstChild("Humanoid") | |
163 | local Parts = Instance.new("Model",Character) | |
164 | local clickDebounce = false | |
165 | local hitBoxEnabled = false | |
166 | local comboFlag = 0 | |
167 | local comboFlag2 = 0 | |
168 | Humanoid.WalkSpeed = 10 | |
169 | Humanoid.Health = 1000 | |
170 | Humanoid.MaxHealth = 1000 | |
171 | Humanoid.JumpPower = 0 | |
172 | Parts.Name = "Hammer" | |
173 | -- Hammer -- | |
174 | HammerHandle = Instance.new("Part",Parts) | |
175 | HammerHandle.Size = Vector3.new(7.7,0.25,0.25) | |
176 | HammerHandle.BrickColor = BrickColor.new("Black") | |
177 | HammerHandle.Anchored = false | |
178 | HammerHandle.Locked = true | |
179 | HammerHandle.Material = "Wood" | |
180 | HammerHandle.CanCollide = false | |
181 | ||
182 | HammerBlock1 = Instance.new("Part",Parts) | |
183 | HammerBlock1.Locked = true | |
184 | HammerBlock1.Size = Vector3.new(1.74,4.20,1.74) | |
185 | HammerBlock1.BrickColor = BrickColor.new("Black") | |
186 | HammerBlock1.Anchored = false | |
187 | HammerBlock1.Material = "Neon" | |
188 | HammerBlock1.CanCollide = false | |
189 | HammerBlock1.Locked = true | |
190 | ||
191 | HammerBlock2 = Instance.new("Part",Parts) | |
192 | HammerBlock2.Size = Vector3.new(1.54,4.45,1.54) | |
193 | HammerBlock2.BrickColor = BrickColor.new("Dark stone grey") | |
194 | HammerBlock2.Anchored = false | |
195 | HammerBlock2.Locked = true | |
196 | HammerBlock2.Material = "Neon" | |
197 | HammerBlock2.CanCollide = false | |
198 | ||
199 | HammerBlock3 = Instance.new("Part",Parts) | |
200 | HammerBlock3.Size = Vector3.new(2,1,2) | |
201 | HammerBlock3.BrickColor = BrickColor.new("Dark stone grey") | |
202 | HammerBlock3.Anchored = false | |
203 | HammerBlock3.Locked = true | |
204 | HammerBlock3.Material = "Neon" | |
205 | HammerBlock3.CanCollide = false | |
206 | ||
207 | HammerBlock4 = Instance.new("Part",Parts) | |
208 | HammerBlock4.Size = Vector3.new(2,1,2) | |
209 | HammerBlock4.BrickColor = BrickColor.new("Dark stone grey") | |
210 | HammerBlock4.Anchored = false | |
211 | HammerBlock4.Locked = true | |
212 | HammerBlock4.Material = "Neon" | |
213 | HammerBlock4.CanCollide = false | |
214 | ||
215 | HammerBlock5 = Instance.new("Part",Parts) | |
216 | HammerBlock5.Size = Vector3.new(1.9,1,1.9) | |
217 | HammerBlock5.BrickColor = BrickColor.new("Really black") | |
218 | HammerBlock5.Anchored = false | |
219 | HammerBlock5.Locked = true | |
220 | HammerBlock5.Material = "Wood" | |
221 | HammerBlock5.CanCollide = false | |
222 | ||
223 | HammerBlock6 = Instance.new("Part",Parts) | |
224 | HammerBlock6.Size = Vector3.new(1.9,1,1.9) | |
225 | HammerBlock6.BrickColor = BrickColor.new("Really black") | |
226 | HammerBlock6.Anchored = false | |
227 | HammerBlock6.Locked = true | |
228 | HammerBlock6.Material = "Wood" | |
229 | HammerBlock6.CanCollide = false | |
230 | ||
231 | HammerBlock7 = Instance.new("Part",Parts) | |
232 | HammerBlock7.Size = Vector3.new(2.15,0.85,2.1) | |
233 | HammerBlock7.BrickColor = BrickColor.new("Really black") | |
234 | HammerBlock7.Anchored = false | |
235 | HammerBlock7.Locked = true | |
236 | HammerBlock7.Material = "Wood" | |
237 | HammerBlock7.CanCollide = false | |
238 | ||
239 | HammerBlock8 = Instance.new("Part",Parts) | |
240 | HammerBlock8.Size = Vector3.new(2.15,0.85,2.1) | |
241 | HammerBlock8.BrickColor = BrickColor.new("Really black") | |
242 | HammerBlock8.Anchored = false | |
243 | HammerBlock8.Locked = true | |
244 | HammerBlock8.Material = "Wood" | |
245 | HammerBlock8.CanCollide = false | |
246 | HammerHitBox = Instance.new("Part",Parts) | |
247 | HammerHitBox.Size = Vector3.new(8.2,4.8,2.25) | |
248 | HammerHitBox.BrickColor = BrickColor.new("Really red") | |
249 | HammerHitBox.Transparency = 1 | |
250 | HammerHitBox.Anchored = false | |
251 | HammerHitBox.Locked = true | |
252 | HammerHitBox.Material = "Neon" | |
253 | HammerHitBox.CanCollide = false | |
254 | HammerHitBoxHandle = Instance.new("Part",Parts) | |
255 | HammerHitBoxHandle.Size = Vector3.new(7.92,0.55,0.55) | |
256 | HammerHitBoxHandle.BrickColor = BrickColor.new("Really red") | |
257 | HammerHitBoxHandle.Transparency = 1 | |
258 | HammerHitBoxHandle.Anchored = false | |
259 | HammerHitBoxHandle.Locked = true | |
260 | HammerHitBoxHandle.Material = "Neon" | |
261 | HammerHitBoxHandle.CanCollide = false | |
262 | HammerSquare1 = Instance.new("Part",Parts) | |
263 | HammerSquare1.Size = Vector3.new(0.25,0.45,0.45) | |
264 | HammerSquare1.BrickColor = BrickColor.new("Dark stone grey") | |
265 | HammerSquare1.Anchored = false | |
266 | HammerSquare1.Locked = true | |
267 | HammerSquare1.Material = "Concrete" | |
268 | HammerSquare1.CanCollide = false | |
269 | HammerSquare2 = Instance.new("Part",Parts) | |
270 | HammerSquare2.Size = Vector3.new(0.25,0.45,0.45) | |
271 | HammerSquare2.BrickColor = BrickColor.new("Dark stone grey") | |
272 | HammerSquare2.Anchored = false | |
273 | HammerSquare2.Locked = true | |
274 | HammerSquare2.Material = "Concrete" | |
275 | HammerSquare2.CanCollide = false | |
276 | HammerSwing1 = Instance.new("Sound",HammerHitBox) | |
277 | HammerSwing1.SoundId = "rbxassetid://145486992" | |
278 | HammerSwing1.Volume = 1 | |
279 | HammerSwing2 = Instance.new("Sound",HammerHitBox) | |
280 | HammerSwing2.SoundId = "rbxassetid://246930031" | |
281 | HammerSwing2.Volume = 2 | |
282 | HammerContact = Instance.new("Sound",HammerHitBox) | |
283 | HammerContact.SoundId = "rbxassetid://130791043" | |
284 | HammerContact.Volume = 1 | |
285 | HammerContact2 = Instance.new("Sound",HammerHitBox) | |
286 | HammerContact2.SoundId = "rbxassetid://146163534" | |
287 | HammerContact2.Volume = 1 | |
288 | ||
289 | -- Welds -- | |
290 | local leftArmWeld = Instance.new("Weld",Character["Left Arm"]) | |
291 | local leftLegWeld = Instance.new("Weld",Character["Left Leg"]) | |
292 | local rightArmWeld = Instance.new("Weld",Character["Right Arm"]) | |
293 | local rightLegWeld = Instance.new("Weld",Character["Right Leg"]) | |
294 | local hammerHandleWeld = Instance.new("Weld",Character["Right Arm"]) | |
295 | local hammerBlock1Weld = Instance.new("Weld",hammerHandleWeld) | |
296 | local hammerBlock2Weld = Instance.new("Weld",hammerHandleWeld) | |
297 | local hammerBlock3Weld = Instance.new("Weld",hammerHandleWeld) | |
298 | local hammerBlock4Weld = Instance.new("Weld",hammerHandleWeld) | |
299 | local hammerBlock5Weld = Instance.new("Weld",hammerHandleWeld) | |
300 | local hammerBlock6Weld = Instance.new("Weld",hammerHandleWeld) | |
301 | local hammerBlock7Weld = Instance.new("Weld",hammerHandleWeld) | |
302 | local hammerBlock8Weld = Instance.new("Weld",hammerHandleWeld) | |
303 | local hammerHitBoxWeld = Instance.new("Weld",hammerHandleWeld) | |
304 | local hammerHitBoxHandleWeld = Instance.new("Weld",hammerHandleWeld) | |
305 | local HammerSquare1Weld = Instance.new("Weld",hammerHandleWeld) | |
306 | local HammerSquare2Weld = Instance.new("Weld",hammerHandleWeld) | |
307 | local headWeld = Instance.new("Weld",Head) | |
308 | local torsoWeld = Instance.new("Weld",Torso) | |
309 | -- WeldsPartC0 -- | |
310 | leftArmWeld.Part0 = Torso | |
311 | leftArmWeld.Part1 = Character["Left Arm"] | |
312 | leftArmWeld.C0 = CFrame.new(-1,0.5,0) | |
313 | rightArmWeld.Part0 = Torso | |
314 | rightArmWeld.Part1 = Character["Right Arm"] | |
315 | rightArmWeld.C0 = CFrame.new(1,0.5,0) | |
316 | leftLegWeld.Part0 = Torso | |
317 | leftLegWeld.Part1 = Character["Left Leg"] | |
318 | leftLegWeld.C0 = CFrame.new(-0.5,-1.0,0) | |
319 | rightLegWeld.Part0 = Torso | |
320 | rightLegWeld.Part1 = Character["Right Leg"] | |
321 | rightLegWeld.C0 = CFrame.new(0.5,-1.0,0) | |
322 | hammerHandleWeld.Part0 = Character["Right Arm"] | |
323 | hammerHandleWeld.Part1 = HammerHandle | |
324 | hammerHandleWeld.C0 = CFrame.new(0,-.90,0) | |
325 | hammerBlock1Weld.Part0 = HammerHandle | |
326 | hammerBlock1Weld.Part1 = HammerBlock1 | |
327 | hammerBlock1Weld.C0 = CFrame.new(-2.5,0,0) | |
328 | hammerBlock2Weld.Part0 = HammerBlock1 | |
329 | hammerBlock2Weld.Part1 = HammerBlock2 | |
330 | hammerBlock2Weld.C0 = CFrame.new(0,0,0) | |
331 | hammerBlock3Weld.Part0 = HammerBlock1 | |
332 | hammerBlock3Weld.Part1 = HammerBlock3 | |
333 | hammerBlock3Weld.C0 = CFrame.new(0,1.55,0) | |
334 | hammerBlock4Weld.Part0 = HammerBlock1 | |
335 | hammerBlock4Weld.Part1 = HammerBlock4 | |
336 | hammerBlock4Weld.C0 = CFrame.new(0,-1.55,0) | |
337 | hammerBlock5Weld.Part0 = HammerBlock1 | |
338 | hammerBlock5Weld.Part1 = HammerBlock5 | |
339 | hammerBlock5Weld.C0 = CFrame.new(0,1,0) | |
340 | hammerBlock6Weld.Part0 = HammerBlock1 | |
341 | hammerBlock6Weld.Part1 = HammerBlock6 | |
342 | hammerBlock6Weld.C0 = CFrame.new(0,-1,0) | |
343 | hammerBlock7Weld.Part0 = HammerBlock1 | |
344 | hammerBlock7Weld.Part1 = HammerBlock7 | |
345 | hammerBlock7Weld.C0 = CFrame.new(0,1.7,0) | |
346 | hammerBlock8Weld.Part0 = HammerBlock1 | |
347 | hammerBlock8Weld.Part1 = HammerBlock8 | |
348 | hammerBlock8Weld.C0 = CFrame.new(0,-1.7,0) | |
349 | hammerHitBoxWeld.Part0 = HammerBlock1 | |
350 | hammerHitBoxWeld.Part1 = HammerHitBox | |
351 | hammerHitBoxWeld.C0 = CFrame.new(2.4,0,0) | |
352 | hammerHitBoxHandleWeld.Part0 = HammerHandle | |
353 | hammerHitBoxHandleWeld.Part1 = HammerHitBoxHandle | |
354 | hammerHitBoxHandleWeld.C0 = CFrame.new(0,0,0) | |
355 | HammerSquare1Weld.Part0 = HammerBlock1 | |
356 | HammerSquare1Weld.Part1 = HammerSquare1 | |
357 | HammerSquare1Weld.C0 = CFrame.new(-.9,0,0) | |
358 | HammerSquare2Weld.Part0 = HammerBlock1 | |
359 | HammerSquare2Weld.Part1 = HammerSquare2 | |
360 | HammerSquare2Weld.C0 = CFrame.new(.9,0,0) | |
361 | torsoWeld.Part0 = HammerHandleWeld | |
362 | torsoWeld.Part1 = Torso | |
363 | headWeld.Part0 = Torso | |
364 | headWeld.Part1 = Head | |
365 | headWeld.C0 = CFrame.new(0,1,0) | |
366 | --[[ | |
367 | local billboard = Instance.new("BillboardGui") | |
368 | billboard.Size = UDim2.new(1,0,1,0) | |
369 | billboard.Parent = HammerSquare1 | |
370 | billboard.AlwaysOnTop = true | |
371 | ||
372 | local frame = Instance.new("Frame",billboard) | |
373 | frame.BorderSizePixel = 0 | |
374 | frame.Transparency = 1 | |
375 | frame.Size = UDim2.new(1,0,1,0) | |
376 | ||
377 | local image = Instance.new("TextLabel",frame) | |
378 | image.Size = UDim2.new(1.5,0,1,0) | |
379 | image.BorderSizePixel = 2 | |
380 | image.TextTransparency = 0 | |
381 | image.TextSize = 35 | |
382 | image.BackgroundTransparency = 1 | |
383 | image.Font = Enum.Font.SourceSansBold | |
384 | image.TextColor3 = Color3.new(0,0,0) | |
385 | image.TextStrokeTransparency = 0 | |
386 | image.TextStrokeColor3 = Color3.new(255,255,255) | |
387 | ]] | |
388 | ||
389 | -- Functions -- | |
390 | local function Debris(x,y,z) | |
391 | wait(1) | |
392 | for i = 1,14 do | |
393 | z.TextTransparency = z.TextTransparency + 0.1 | |
394 | z.TextStrokeTransparency = z.TextStrokeTransparency + 0.1 | |
395 | wait() | |
396 | end | |
397 | game:GetService("Debris"):AddItem(x,y) | |
398 | end | |
399 | function Chat(playername,pos) | |
400 | local billboard = Instance.new("BillboardGui") | |
401 | billboard.Size = UDim2.new(1,0,1,0) | |
402 | billboard.Parent = HammerSquare1 | |
403 | billboard.AlwaysOnTop = true | |
404 | ||
405 | local frame = Instance.new("Frame",billboard) | |
406 | frame.BorderSizePixel = 0 | |
407 | frame.Transparency = 1 | |
408 | frame.Size = UDim2.new(1,0,1,0) | |
409 | ||
410 | local image = Instance.new("TextLabel",frame) | |
411 | image.Size = UDim2.new(1.5,0,1,0) | |
412 | image.BorderSizePixel = 2 | |
413 | image.TextTransparency = 0 | |
414 | image.TextSize = 35 | |
415 | image.BackgroundTransparency = 1 | |
416 | image.Font = Enum.Font.SourceSansBold | |
417 | image.TextColor3 = Color3.new(0,0,0) | |
418 | image.TextStrokeTransparency = 0 | |
419 | image.TextStrokeColor3 = Color3.new(255,255,255) | |
420 | image.Text = "[ "..playername.." ] has been nil'd." | |
421 | Spawn(function() | |
422 | Debris(billboard,1,image) | |
423 | ||
424 | end) | |
425 | end | |
426 | ||
427 | ||
428 | -- Walking Idle -- | |
429 | Spawn(function() | |
430 | while RunService.Stepped:Wait() do | |
431 | if hitBoxEnabled == true then | |
432 | HammerHitBox.Transparency = 0.85 | |
433 | HammerHitBoxHandle.Transparency = 0.85 | |
434 | else | |
435 | HammerHitBox.Transparency = 01 | |
436 | HammerHitBoxHandle.Transparency = 1 | |
437 | end | |
438 | local positionSpeed = (HammerHandleWeld.Velocity * Vector3.new(1,0,1)).magnitude | |
439 | if positionSpeed < 1 then | |
440 | if clickDebounce == true then repeat wait() until clickDebounce == false end | |
441 | leftArmWeld.C1 = leftArmWeld.C1:Lerp(CFrame.new(0.5,0.5,0) * CFrame.Angles(-math.rad(70),math.rad(15),-math.rad(45)),0.2) | |
442 | rightArmWeld.C1 = rightArmWeld.C1:Lerp(CFrame.new(-0.5,0.5,0) * CFrame.Angles(-math.rad(45),0,math.rad(45) + -math.cos(tick()*4)/17),0.2) | |
443 | leftLegWeld.C1 = leftLegWeld.C1:Lerp(CFrame.new(0,1 + -math.cos(tick()*4)/17,0) * CFrame.Angles(-math.rad(15),-math.rad(50) + math.cos(tick()*4)/17,0),0.2) | |
444 | rightLegWeld.C1 = rightLegWeld.C1:Lerp(CFrame.new(0,1 + -math.cos(tick()*4)/17,0) * CFrame.Angles(math.rad(15),-math.rad(50) + math.cos(tick()*4)/17,0),0.2) | |
445 | torsoWeld.C1 = torsoWeld.C1:Lerp(CFrame.new(0,math.cos(tick()*4)/17,0) * CFrame.Angles(0,math.rad(55),0),0.2) | |
446 | headWeld.C1 = headWeld.C1:Lerp(CFrame.new(0,-0.5,0) * CFrame.Angles(math.rad(5),-math.rad(45),0),0.2) | |
447 | hammerBlock1Weld.C1 = hammerBlock1Weld.C1:Lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),0.2) | |
448 | hammerHandleWeld.C1 = hammerHandleWeld.C1:Lerp(CFrame.new(2.5,0,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)),0.2) | |
449 | elseif positionSpeed > 1 then | |
450 | if clickDebounce == true then repeat wait() until clickDebounce == false end | |
451 | leftArmWeld.C1 = leftArmWeld.C1:Lerp(CFrame.new(0.5,0.5,0) * CFrame.Angles(-math.rad(120),math.rad(45),math.rad(45)),0.2) | |
452 | rightArmWeld.C1 = rightArmWeld.C1:Lerp(CFrame.new(-0.5,0.5,0) * CFrame.Angles(-math.rad(45),-math.rad(170),math.rad(160) ),0.2) | |
453 | leftLegWeld.C1 = leftLegWeld.C1:Lerp(CFrame.new(0,1,0) * CFrame.Angles(math.cos(tick()*6)/2,-math.rad(50),0),0.2) | |
454 | rightLegWeld.C1 = rightLegWeld.C1:Lerp(CFrame.new(0,1,0) * CFrame.Angles(-math.cos(tick()*6)/2,-math.rad(50),0),0.2) | |
455 | torsoWeld.C1 = torsoWeld.C1:Lerp(CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(55),0),0.2) | |
456 | headWeld.C1 = headWeld.C1:Lerp(CFrame.new(0,-0.5,0) * CFrame.Angles(math.rad(5),-math.rad(45),0),0.2) | |
457 | hammerBlock1Weld.C1 = hammerBlock1Weld.C1:Lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(45),0,0),0.2) | |
458 | hammerHandleWeld.C1 = hammerHandleWeld.C1:Lerp(CFrame.new(2.5,0,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)),0.2) | |
459 | end | |
460 | ||
461 | end | |
462 | end) | |
463 | -- | |
464 | local lastAttack = 0 | |
465 | local lastHit = "" | |
466 | function KeyPress(Key) | |
467 | if Key == Enum.KeyCode.E then | |
468 | wait() | |
469 | local t = game:GetService("RunService").Stepped:wait() | |
470 | if (t - lastAttack) > 0.7 or comboFlag2 == 2 then | |
471 | comboFlag2 = 0 | |
472 | end | |
473 | if clickDebounce then return end | |
474 | clickDebounce = true | |
475 | if comboFlag2 == 0 then | |
476 | HammerSwing1:Play() | |
477 | for i = 1,15 do | |
478 | leftArmWeld.C1 = leftArmWeld.C1:Lerp(CFrame.new(0.5,0.5,0) * CFrame.Angles(math.rad(55),-math.rad(35),math.rad(45)),0.3) | |
479 | rightArmWeld.C1 = rightArmWeld.C1:Lerp(CFrame.new(-0.5,0.5,0) * CFrame.Angles(-math.rad(120),-math.rad(45),-math.rad(55)),0.3) | |
480 | leftLegWeld.C1 = leftLegWeld.C1:Lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(0),-math.rad(0),0),0.3) | |
481 | rightLegWeld.C1 = rightLegWeld.C1:Lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(0),-math.rad(0),0),0.3) | |
482 | torsoWeld.C1 = torsoWeld.C1:Lerp(CFrame.new(0,0,0) * CFrame.Angles(-math.rad(0),-math.rad(35),0),0.3) | |
483 | headWeld.C1 = headWeld.C1:Lerp(CFrame.new(0,-0.5,0) * CFrame.Angles(0,-math.rad(75),0),0.3) | |
484 | hammerBlock1Weld.C1 = hammerBlock1Weld.C1:Lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),0.3) | |
485 | hammerHandleWeld.C1 = hammerHandleWeld.C1:Lerp(CFrame.new(2.5,0,0) * CFrame.Angles(math.rad(0),math.rad(0),-math.rad(30)),0.3) | |
486 | game:GetService("RunService").Stepped:wait() | |
487 | end | |
488 | local connection1 = HammerHitBox.Touched:connect(function(hit) | |
489 | pcall(function() | |
490 | if hit.Parent == Character then return end | |
491 | if hit.Parent.Name == lastHit then return end | |
492 | debounce = true | |
493 | local human = hit.Parent:FindFirstChildOfClass("Humanoid") | |
494 | if human and debounce then | |
495 | asd = hit.Parent | |
496 | lastHit = asd.Name | |
497 | human:TakeDamage(15) | |
498 | HammerContact2:Play() | |
499 | asd:FindFirstChild("Torso").Velocity = Torso.CFrame.lookVector * 200 | |
500 | end | |
501 | end) | |
502 | end) | |
503 | lastHit = "" | |
504 | wait() | |
505 | for i = 1,9 do -- move 1 | |
506 | leftArmWeld.C1 = leftArmWeld.C1:Lerp(CFrame.new(0.5,0.5,0) * CFrame.Angles(math.rad(10),-math.rad(35),math.rad(45)),0.3) | |
507 | rightArmWeld.C1 = rightArmWeld.C1:Lerp(CFrame.new(-0.5,0.5,0) * CFrame.Angles(-math.rad(100),math.rad(75),-math.rad(0)),0.3) | |
508 | leftLegWeld.C1 = leftLegWeld.C1:Lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(0),-math.rad(0),0),0.3) | |
509 | rightLegWeld.C1 = rightLegWeld.C1:Lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(0),-math.rad(0),0),0.3) | |
510 | torsoWeld.C1 = torsoWeld.C1:Lerp(CFrame.new(0,0,0) * CFrame.Angles(-math.rad(0),-math.rad(0),0),0.3) | |
511 | headWeld.C1 = headWeld.C1:Lerp(CFrame.new(0,-0.5,0) * CFrame.Angles(0,math.rad(50),0),0.3) | |
512 | hammerBlock1Weld.C1 = hammerBlock1Weld.C1:Lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),0.3) | |
513 | hammerHandleWeld.C1 = hammerHandleWeld.C1:Lerp(CFrame.new(2.5,0,0) * CFrame.Angles(math.rad(0),math.rad(0),-math.rad(30)),0.3) | |
514 | game:GetService("RunService").Stepped:wait() | |
515 | end | |
516 | connection1:disconnect() | |
517 | wait(0.35) | |
518 | clickDebounce = false | |
519 | debounce = false | |
520 | comboFlag2 = comboFlag2 + 1 | |
521 | lastAttack = t | |
522 | elseif comboFlag2 == 1 then | |
523 | local connection2 = HammerHitBox.Touched:connect(function(hit) | |
524 | pcall(function() | |
525 | if hit.Parent == Character then return end | |
526 | if hit.Parent.Name == lastHit then return end | |
527 | debounce = true | |
528 | local human = hit.Parent:FindFirstChildOfClass("Humanoid") | |
529 | if human and debounce then | |
530 | asd = hit.Parent | |
531 | lastHit = asd.Name | |
532 | human:TakeDamage(15) | |
533 | HammerContact2:Play() | |
534 | asd:FindFirstChild("Torso").Velocity = Torso.CFrame.lookVector * 200 | |
535 | end | |
536 | end) | |
537 | end) | |
538 | for i = 1,15 do -- move 1 | |
539 | leftArmWeld.C1 = leftArmWeld.C1:Lerp(CFrame.new(0.5,0.5,0) * CFrame.Angles(math.rad(10),-math.rad(35),math.rad(45)),0.3) | |
540 | rightArmWeld.C1 = rightArmWeld.C1:Lerp(CFrame.new(-0.5,0.5,0) * CFrame.Angles(-math.rad(100),math.rad(75),-math.rad(0)),0.3) | |
541 | leftLegWeld.C1 = leftLegWeld.C1:Lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(0),-math.rad(0),0),0.3) | |
542 | rightLegWeld.C1 = rightLegWeld.C1:Lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(0),-math.rad(0),0),0.3) | |
543 | torsoWeld.C1 = torsoWeld.C1:Lerp(CFrame.new(0,0,0) * CFrame.Angles(-math.rad(0),-math.rad(0),0),0.3) | |
544 | headWeld.C1 = headWeld.C1:Lerp(CFrame.new(0,-0.5,0) * CFrame.Angles(0,math.rad(50),0),0.3) | |
545 | hammerBlock1Weld.C1 = hammerBlock1Weld.C1:Lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),0.3) | |
546 | hammerHandleWeld.C1 = hammerHandleWeld.C1:Lerp(CFrame.new(2.5,0,0) * CFrame.Angles(math.rad(0),math.rad(0),-math.rad(30)),0.3) | |
547 | game:GetService("RunService").Stepped:wait() | |
548 | end | |
549 | wait() | |
550 | for i = 1,9 do | |
551 | leftArmWeld.C1 = leftArmWeld.C1:Lerp(CFrame.new(0.5,0.5,0) * CFrame.Angles(math.rad(55),-math.rad(35),math.rad(45)),0.3) | |
552 | rightArmWeld.C1 = rightArmWeld.C1:Lerp(CFrame.new(-0.5,0.5,0) * CFrame.Angles(-math.rad(120),-math.rad(45),-math.rad(55)),0.3) | |
553 | leftLegWeld.C1 = leftLegWeld.C1:Lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(0),-math.rad(0),0),0.3) | |
554 | rightLegWeld.C1 = rightLegWeld.C1:Lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(0),-math.rad(0),0),0.3) | |
555 | torsoWeld.C1 = torsoWeld.C1:Lerp(CFrame.new(0,0,0) * CFrame.Angles(-math.rad(0),-math.rad(35),0),0.3) | |
556 | headWeld.C1 = headWeld.C1:Lerp(CFrame.new(0,-0.5,0) * CFrame.Angles(0,-math.rad(75),0),0.3) | |
557 | hammerBlock1Weld.C1 = hammerBlock1Weld.C1:Lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),0.3) | |
558 | hammerHandleWeld.C1 = hammerHandleWeld.C1:Lerp(CFrame.new(2.5,0,0) * CFrame.Angles(math.rad(0),math.rad(0),-math.rad(30)),0.3) | |
559 | game:GetService("RunService").Stepped:wait() | |
560 | end | |
561 | connection2:disconnect() | |
562 | clickDebounce = false | |
563 | debounce = false | |
564 | lastAttack = t | |
565 | comboFlag2 = comboFlag2 + 1 | |
566 | end | |
567 | ||
568 | elseif Key == Enum.KeyCode.Z then | |
569 | if hitBoxEnabled == false then | |
570 | wait(1) | |
571 | hitBoxEnabled = true | |
572 | else | |
573 | hitBoxEnabled = false | |
574 | end | |
575 | ||
576 | elseif Key == Enum.KeyCode.Q then | |
577 | wait() | |
578 | if clickDebounce then return end | |
579 | clickDebounce = true | |
580 | local connection1 = HammerHitBox.Touched:connect(function(hit) | |
581 | pcall(function() | |
582 | if hit.Parent == Character then return end | |
583 | if hit.Parent.Name == lastHit then return end | |
584 | debounce = true | |
585 | local human = hit.Parent:FindFirstChildOfClass("Humanoid") | |
586 | if human and debounce then | |
587 | asd = hit.Parent | |
588 | lastHit = asd.Name | |
589 | HammerContact:Play() | |
590 | asd.Parent = nil | |
591 | if asd.Parent == nil then | |
592 | Chat(asd.Name) | |
593 | end | |
594 | end | |
595 | end) | |
596 | end) | |
597 | lastHit = "" | |
598 | HammerSwing1:Play() | |
599 | for i = 1,15 do | |
600 | leftArmWeld.C1 = leftArmWeld.C1:Lerp(CFrame.new(0.5,1,0) * CFrame.Angles(-math.rad(190),-math.rad(0),math.rad(35)),0.3) | |
601 | rightArmWeld.C1 = rightArmWeld.C1:Lerp(CFrame.new(-0.5,1,0) * CFrame.Angles(-math.rad(190),math.rad(0),-math.rad(35)),0.3) | |
602 | leftLegWeld.C1 = leftLegWeld.C1:Lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(25),-math.rad(0),0),0.3) | |
603 | rightLegWeld.C1 = rightLegWeld.C1:Lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(25),-math.rad(0),0),0.3) | |
604 | torsoWeld.C1 = torsoWeld.C1:Lerp(CFrame.new(0,-3,0) * CFrame.Angles(-math.rad(35),-math.rad(0),0),0.3) | |
605 | headWeld.C1 = headWeld.C1:Lerp(CFrame.new(0,-0.5,0) * CFrame.Angles(math.rad(0),-math.rad(0),0),0.3) | |
606 | hammerBlock1Weld.C1 = hammerBlock1Weld.C1:Lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),0.3) | |
607 | hammerHandleWeld.C1 = hammerHandleWeld.C1:Lerp(CFrame.new(2.5,0.5,0) * CFrame.Angles(math.rad(5),math.rad(90),math.rad(0)),0.3) | |
608 | game:GetService("RunService").Stepped:wait() | |
609 | end | |
610 | wait(0.25) | |
611 | HammerSwing2:Play() | |
612 | for i = 1,9 do -- move 1 | |
613 | leftArmWeld.C1 = leftArmWeld.C1:Lerp(CFrame.new(0.5,1,0) * CFrame.Angles(-math.rad(112),math.rad(25),math.rad(35)),0.2) | |
614 | rightArmWeld.C1 = rightArmWeld.C1:Lerp(CFrame.new(-0.5,1,0) * CFrame.Angles(-math.rad(112),-math.rad(25),-math.rad(35)),0.2) | |
615 | leftLegWeld.C1 = leftLegWeld.C1:Lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(25),-math.rad(0),0),0.2) | |
616 | rightLegWeld.C1 = rightLegWeld.C1:Lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(25),-math.rad(0),0),0.2) | |
617 | torsoWeld.C1 = torsoWeld.C1:Lerp(CFrame.new(0,3,0) * CFrame.Angles(math.rad(145),-math.rad(0),0),0.2) | |
618 | headWeld.C1 = headWeld.C1:Lerp(CFrame.new(0,-0.5,0) * CFrame.Angles(math.rad(0),-math.rad(0),0),0.2) | |
619 | hammerBlock1Weld.C1 = hammerBlock1Weld.C1:Lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(104),0,0),0.2) | |
620 | hammerHandleWeld.C1 = hammerHandleWeld.C1:Lerp(CFrame.new(2.5,0,0) * CFrame.Angles(math.rad(0),math.rad(90),math.rad(60)),0.2) | |
621 | game:GetService("RunService").Stepped:wait() | |
622 | end | |
623 | connection1:disconnect() | |
624 | wait(0.35) | |
625 | clickDebounce = false | |
626 | debounce = false | |
627 | end | |
628 | end | |
629 | ||
630 | if InputService.KeyboardEnabled then | |
631 | function onInput(input,processed) | |
632 | if input.UserInputType == Enum.UserInputType.Keyboard then | |
633 | KeyPress(input.KeyCode) | |
634 | ||
635 | end | |
636 | end | |
637 | end | |
638 | InputService.InputBegan:connect(onInput) | |
639 | InputService.InputChanged:connect(onInput) |