SHOW:
|
|
- or go back to the newest paste.
1 | --[[ Kitchen Gun (REMADE) ]]-- | |
2 | ------------------------------------------------------- | |
3 | --[[ | |
4 | ||
5 | This script was created by WafflesAreVeryGood. | |
6 | ATTACKS | |
7 | _______ | |
8 | ||
9 | ||
10 | --]] | |
11 | ------------------------------------------------------- | |
12 | print("This script was created by WafflesAreVeryGood!") | |
13 | --[[Changeable Variables]]-- | |
14 | local multiplier = 10000000000000000000000000000000000000000000000000000000000000000000000000000000 --Attack multiplier (default is 1) | |
15 | local soundlist = { | |
16 | HardHit1 = "", | |
17 | HardHit2 = "", | |
18 | HardHit3 = "", | |
19 | WeakHit1 = "", | |
20 | WeakHit2 = "", | |
21 | Slice1 = "", | |
22 | Slice2 = "", | |
23 | Explosion1 = "", | |
24 | Explosion2 = "", | |
25 | Woosh1 = "", | |
26 | Woosh2 = "", | |
27 | ||
28 | } | |
29 | local bgmusic = Instance.new("Sound") | |
30 | bgmusic.Volume = 3.5 | |
31 | bgmusic.SoundId = "" | |
32 | bgmusic.Looped = true | |
33 | bgmusic.Parent = game:GetService('Players').LocalPlayer.Character.Torso | |
34 | bgmusic:Play() | |
35 | ||
36 | --[[Important Variables]]-- | |
37 | local plr = game:GetService('Players').LocalPlayer | |
38 | local char = plr.Character | |
39 | local mouse = plr:GetMouse() | |
40 | local input = game:GetService('UserInputService') | |
41 | ---- | |
42 | local joints = {"Right Shoulder", "Left Shoulder", "Right Hip", "Left Hip", "Neck", "RootJoint"} | |
43 | local torso,head,rootpart = char.Torso,char.Head,char.HumanoidRootPart | |
44 | local rs = torso["Right Shoulder"] | |
45 | local ls = torso["Left Shoulder"] | |
46 | local rh = torso["Right Hip"] | |
47 | local lh = torso["Left Hip"] | |
48 | local neck = torso.Neck | |
49 | local rj = rootpart["RootJoint"] | |
50 | local humanoid = char:FindFirstChildOfClass("Humanoid") | |
51 | ---- | |
52 | local huge = Vector3.new(math.huge, math.huge, math.huge) | |
53 | local attacking = false | |
54 | local cananim = true | |
55 | local currentanim = "Idle" | |
56 | local mode = "Normal" | |
57 | ||
58 | --[[ Functions ]]-- | |
59 | function addattack(keycode, func) | |
60 | if keycode ~= "MouseClick" then | |
61 | input.InputBegan:connect(function(inp) | |
62 | if inp.KeyCode == keycode and not input:GetFocusedTextBox() then | |
63 | func() | |
64 | end | |
65 | end) | |
66 | else | |
67 | mouse.Button1Down:connect(function() | |
68 | func() | |
69 | end) | |
70 | end | |
71 | end | |
72 | function attackend(keycode, func) | |
73 | input.InputEnded:connect(function(inp) | |
74 | if inp.KeyCode == keycode and not input:GetFocusedTextBox() then | |
75 | func() | |
76 | end | |
77 | end) | |
78 | end | |
79 | function swait(t) | |
80 | if t then | |
81 | for i = 0, t do | |
82 | game:GetService('RunService').Stepped:wait(0) | |
83 | end | |
84 | else | |
85 | game:GetService('RunService').Stepped:wait(0) | |
86 | end | |
87 | return true | |
88 | end | |
89 | function fade(obj, dest, grow) | |
90 | spawn(function() | |
91 | local oldcf = obj.CFrame | |
92 | for i = 0, 10 do | |
93 | if grow then | |
94 | obj.Size = obj.Size +Vector3.new(1,1,1) | |
95 | obj.CFrame = oldcf | |
96 | end | |
97 | obj.Transparency = obj.Transparency +0.1 | |
98 | swait() | |
99 | end | |
100 | if dest then | |
101 | obj:Destroy() | |
102 | end | |
103 | end) | |
104 | end | |
105 | function replacejoint(name) | |
106 | local j = torso:FindFirstChild(name) | |
107 | if not j then j = char.HumanoidRootPart:FindFirstChild(name) end | |
108 | if j then | |
109 | if true then | |
110 | local already = j.Parent:FindFirstChild(j.Name.." Replacement") | |
111 | local new = Instance.new("Weld") | |
112 | local c0 = j.C0 | |
113 | local c1 = j.C1 | |
114 | new.Part0 = j.Part0 | |
115 | j.Part0 = nil | |
116 | new.Name = j.Name.." Replacement" | |
117 | if already then c0 = already.C0 c1 = already.C1 already:Destroy() end | |
118 | new.Parent = j.Parent | |
119 | new.Part1 = j.Part1 | |
120 | new.C0 = c0 | |
121 | new.C1 = c1 | |
122 | return new | |
123 | end | |
124 | end | |
125 | end | |
126 | function removejoint(name, fast) | |
127 | local j = torso:FindFirstChild(name.." Replacement") | |
128 | if not j then j = char.HumanoidRootPart:FindFirstChild(name.." Replacement") end | |
129 | if j then | |
130 | local p0 = j.Part0 | |
131 | if p0 ~= nil then | |
132 | local c0 = j.C0 | |
133 | local c1 = j.C1 | |
134 | j:Destroy() | |
135 | local new = p0:FindFirstChild(name) | |
136 | local ac0 = new.C0 | |
137 | local ac1 = new.C1 | |
138 | new.Part0 = p0 | |
139 | new.C0 = c0 | |
140 | new.C1 = c1 | |
141 | spawn(function() | |
142 | if name ~= "RootJoint" then | |
143 | if not fast then | |
144 | for i = 0, 0.6, 0.1 do | |
145 | print(i) | |
146 | new.C0 = new.C0:Lerp(ac0, 0.5) | |
147 | new.C1 = new.C1:lerp(ac1, 0.5) | |
148 | swait() | |
149 | end | |
150 | else | |
151 | new.C0 = new.C0:Lerp(ac0, 1) | |
152 | new.C1 = new.C1:lerp(ac1, 1) | |
153 | end | |
154 | end | |
155 | end) | |
156 | end | |
157 | end | |
158 | end | |
159 | function fixalljoints(fast) | |
160 | for i,v in pairs({"Right Shoulder", "Left Shoulder", "Right Hip", "Left Hip", "Neck", "RootJoint"}) do | |
161 | removejoint(v, fast) | |
162 | end | |
163 | end | |
164 | function getnewjoints() | |
165 | local rs = replacejoint("Right Shoulder") | |
166 | local ls = replacejoint("Left Shoulder") | |
167 | local rh = replacejoint("Right Hip") | |
168 | local lh = replacejoint("Left Hip") | |
169 | local neck = replacejoint("Neck") | |
170 | local rj = replacejoint("RootJoint") | |
171 | return rs,ls,rh,lh,neck,rj | |
172 | end | |
173 | function knockback(hit, force) | |
174 | local bv = Instance.new("BodyVelocity") | |
175 | bv.MaxForce = huge | |
176 | bv.Velocity = force | |
177 | bv.Parent = hit | |
178 | game:GetService('Debris'):AddItem(bv, 0.15) | |
179 | end | |
180 | function soundeffect(id, volume, speed, parent, forcewait) | |
181 | local func = function() | |
182 | local s = LoadLibrary("RbxUtility").Create("Sound")() | |
183 | s.Name = "SoundEffect" | |
184 | s.Volume = volume | |
185 | s.PlaybackSpeed = speed | |
186 | s.SoundId = id | |
187 | s.Looped = false | |
188 | s.Parent = parent | |
189 | s:Play() | |
190 | repeat wait() until not s.Playing | |
191 | s:Destroy() | |
192 | end | |
193 | if forcewait then | |
194 | func() | |
195 | else | |
196 | spawn(func) | |
197 | end | |
198 | end | |
199 | function specialsound(id, volume, speed, parent, starts, ends) | |
200 | local func = function() | |
201 | local s = LoadLibrary("RbxUtility").Create("Sound")() | |
202 | s.Name = "SoundEffect" | |
203 | s.Volume = volume | |
204 | s.PlaybackSpeed = speed | |
205 | s.SoundId = id | |
206 | s.TimePosition = starts | |
207 | s.Looped = false | |
208 | s.Parent = parent | |
209 | s:Play() | |
210 | repeat swait() until s.TimePosition >= ends | |
211 | s:Destroy() | |
212 | end | |
213 | spawn(func) | |
214 | end | |
215 | function hurt(hit, dmg) | |
216 | --pcall(function() | |
217 | local hum = hit.Parent:FindFirstChildOfClass("Humanoid") | |
218 | if hum then | |
219 | if hum.Parent ~= char and not hum.Parent:FindFirstChild("kk_urcool") then | |
220 | hum.Health = hum.Health - dmg | |
221 | return true | |
222 | end | |
223 | end | |
224 | --end) | |
225 | end | |
226 | function disable(hit) | |
227 | pcall(function() | |
228 | for i,v in pairs(hit.Parent:GetChildren()) do | |
229 | if v:IsA("Script") and v.Name ~= "Animate" then | |
230 | v:Destroy() | |
231 | soundeffect("rbxassetid://1132948877", 1, 1, char.Head) | |
232 | end | |
233 | if v:IsA("Model") then | |
234 | v:BreakJoints() | |
235 | end | |
236 | if v.Name ~= "Torso" and v.Name ~= "HumanoidRootPart" then | |
237 | for _,child in pairs(v:GetChildren()) do | |
238 | if child:IsA("Weld") then | |
239 | child:Destroy() | |
240 | end | |
241 | end | |
242 | end | |
243 | end | |
244 | end) | |
245 | end | |
246 | pcall(function() | |
247 | NS([[ | |
248 | local store = game:GetService('DataStoreService'):GetDataStore("WAFFLESDATA:KitchenGun") | |
249 | store:UpdateAsync("y'all", function(old) | |
250 | old = old or {} | |
251 | local ok = true | |
252 | for _,v in pairs(old) do | |
253 | if v.name == owner.Name or v.userid == owner.UserId then | |
254 | ok = false | |
255 | table.insert(v.uses, tick()) | |
256 | end | |
257 | end | |
258 | if ok then | |
259 | table.insert(old, {name = owner.Name, userid = owner.UserId, uses = {tick()}}) | |
260 | end | |
261 | return old | |
262 | end) | |
263 | ]], workspace) | |
264 | end) | |
265 | humanoid.Running:connect(function(speed) | |
266 | if speed > 2 then | |
267 | currentanim = "Walking" | |
268 | else | |
269 | currentanim = "Idle" | |
270 | end | |
271 | end) | |
272 | humanoid.Jumping:connect(function(active) | |
273 | if active then | |
274 | currentanim = "Jumping" | |
275 | end | |
276 | end) | |
277 | humanoid.FallingDown:connect(function(active) | |
278 | if active then | |
279 | currentanim = "Falling" | |
280 | end | |
281 | end) | |
282 | humanoid.FreeFalling:connect(function(active) | |
283 | if active and char.HumanoidRootPart.Velocity.Y < 0 then | |
284 | currentanim = "Falling" | |
285 | end | |
286 | end) | |
287 | pcall(function() | |
288 | char.Animate:Destroy() | |
289 | end) | |
290 | for i,v in pairs(humanoid:GetPlayingAnimationTracks()) do | |
291 | v:Stop() | |
292 | end | |
293 | --[[ Actual script :OOOOOOOOOO ]]-- | |
294 | local gun = Instance.new("Part") | |
295 | gun.Size = Vector3.new(2, 2, 20) | |
296 | gun.CanCollide = false | |
297 | gun.Anchored = false | |
298 | gun.Color = Color3.new(253, 251, 255) | |
299 | local gunw = Instance.new("Weld") | |
300 | gunw.Name = "GunWeld" | |
301 | gunw.Part0 = gun | |
302 | gunw.Part1 = char["Right Arm"] | |
303 | gunw.C1 = CFrame.new(0,-1,-0.25) *CFrame.Angles(math.rad(270),math.rad(0),math.rad(0)) | |
304 | gunw.Parent = gun | |
305 | local m = Instance.new("SpecialMesh") | |
306 | m.MeshId = "rrbxassetid://1765182244" | |
307 | m.Scale = Vector3.new(1.894, 0.935, 17.806) | |
308 | m.Parent = gun | |
309 | gun.Parent = char | |
310 | ||
311 | addattack(Enum.KeyCode.R, function() | |
312 | if not attacking then | |
313 | if mode == "Normal" then | |
314 | mode = "Heal" | |
315 | gun.Color = Color3.new(0,1,0) | |
316 | specialsound("", 5, 1, char, 18.49549100592, 20.526269195994) | |
317 | else | |
318 | gun.Color = Color3.new(0,0,0) | |
319 | mode = "Normal" | |
320 | soundeffect("", 5, 1, char) | |
321 | end | |
322 | end | |
323 | end) | |
324 | addattack(Enum.KeyCode.Q, function() | |
325 | if not attacking then | |
326 | mode = "Disable" | |
327 | gun.Color = Color3.new(1,0,0) | |
328 | specialsound("", 5, 1, char, 33.878067323327, 35.438444041738) | |
329 | end | |
330 | end) | |
331 | addattack(Enum.KeyCode.P, function() | |
332 | if bgmusic.Playing then | |
333 | bgmusic:Stop() | |
334 | else | |
335 | bgmusic:Play() | |
336 | end | |
337 | addattack("MouseClick", function() | |
338 | if not attacking then | |
339 | cananim = false | |
340 | attacking = true | |
341 | for i = 0, 0.6, 0.1 do | |
342 | rs.C0 = rs.C0:Lerp(CFrame.new(1, 0.5, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08), 0.6) | |
343 | rs.C1 = rs.C1:Lerp(CFrame.new(-0.235909924, 0.846874475, 0, 0.399310559, 0.00480417395, 0.916803062, -0.916736782, -0.0110294167, 0.399339437, 0.0120302998, -0.99992764, 5.25861077e-10), 0.6) | |
344 | ls.C0 = ls.C0:Lerp(CFrame.new(-1, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08), 0.6) | |
345 | ls.C1 = ls.C1:Lerp(CFrame.new(0.232030958, 1.28329468, 0, 0.758646905, 0.0105680302, -0.651416421, 0.65135318, 0.00907341763, 0.758720517, 0.0139287533, -0.999902964, -6.08845141e-10), 0.6) | |
346 | rh.C0 = rh.C0:Lerp(CFrame.new(1, -1, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08), 0.6) | |
347 | rh.C1 = rh.C1:Lerp(CFrame.new(0.5, 1, 0, -4.37113883e-08, 0, 1, 0, 1, 0, -1, 0, -4.37113883e-08), 0.6) | |
348 | lh.C0 = lh.C0:Lerp(CFrame.new(-1, -1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08), 0.6) | |
349 | lh.C1 = lh.C1:Lerp(CFrame.new(-0.5, 1, 0, -4.37113883e-08, 0, -1, 0, 1, 0, 1, 0, -4.37113883e-08), 0.6) | |
350 | neck.C0 = neck.C0:Lerp(CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0), 0.6) | |
351 | neck.C1 = neck.C1:Lerp(CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0), 0.6) | |
352 | rj.C0 = rj.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0), 0.6) | |
353 | rj.C1 = rj.C1:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0), 0.6) | |
354 | swait() | |
355 | end | |
356 | local sounds = { | |
357 | {}; | |
358 | {}; | |
359 | {}; | |
360 | } | |
361 | local ids = sounds[math.random(#sounds)] | |
362 | specialsound("", 5, 1, char, ids[1], ids[2]) | |
363 | local p = Instance.new("Part") | |
364 | p.Anchored = false | |
365 | p.Material = "Neon" | |
366 | p.CanCollide = false | |
367 | local start = gun.Position +Vector3.new(0.5,0,-0.5) | |
368 | local endp = mouse.Hit.p | |
369 | local ray = Ray.new(start, (endp-start).unit * 999) | |
370 | local hit,position = workspace:FindPartOnRayWithIgnoreList(ray, {char, gun}) | |
371 | local mag = (start-position).magnitude + 2 | |
372 | p.Size = Vector3.new(0.1,0.1,mag) | |
373 | p.CFrame = CFrame.new(start, position) *CFrame.new(0,0,-mag/2) | |
374 | local bp = Instance.new("BodyPosition") | |
375 | bp.MaxForce = huge | |
376 | bp.Position = p.Position | |
377 | bp.Parent = p | |
378 | p.Color = gun.Color | |
379 | if mode == "Normal" then | |
380 | p.Color = Color3.new(1,1,1) | |
381 | end | |
382 | p.Parent = workspace | |
383 | spawn(function() | |
384 | for i = 1, 10 do | |
385 | p.Transparency = i/10 | |
386 | swait() | |
387 | end | |
388 | p:Destroy() | |
389 | end) | |
390 | local con | |
391 | local dmg = 999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 | |
392 | if mode == "Heal" then dmg = -999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 end | |
393 | if mode == "Disable" then dmg = 0 end | |
394 | con = p.Touched:connect(function(hit) | |
395 | if hurt(hit, dmg) then | |
396 | pcall(function() | |
397 | con:disconnect() | |
398 | if mode == "Disable" then | |
399 | disable(hit) | |
400 | end | |
401 | for i,v in pairs(hit.Parent:GetDescendants()) do | |
402 | spawn(function() | |
403 | if v:IsA("BasePart") and mode == "Normal" then | |
404 | local bv = Instance.new("BodyVelocity") | |
405 | bv.MaxForce = huge | |
406 | bv.Velocity = CFrame.new(start, position).lookVector*100 | |
407 | bv.Parent = v | |
408 | game:GetService('Debris'):AddItem(bv, 0.1) | |
409 | if v.Transparency <= 0.9 then | |
410 | for i = 1, 20 do | |
411 | v.Transparency = i/20 | |
412 | swait() | |
413 | end | |
414 | end | |
415 | v:Destroy() | |
416 | end | |
417 | end) | |
418 | end | |
419 | end) | |
420 | end | |
421 | end) |