SHOW:
|
|
- or go back to the newest paste.
1 | -- This script has been converted to FE by iPxter | |
2 | - | sp = game.Players.LocalPlayer.Character |
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").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 | ||
87 | --encript | |
88 | sp = owner.Character | |
89 | sp.Head.face.Texture = "http://www.roblox.com/asset/?id=109676489" | |
90 | sp["Body Colors"].HeadColor = BrickColor.new("Bright yellow") | |
91 | sp["Body Colors"].TorsoColor = BrickColor.new("Bright blue") | |
92 | sp["Body Colors"].LeftArmColor = BrickColor.new("Bright yellow") | |
93 | sp["Body Colors"].RightArmColor = BrickColor.new("Bright yellow") | |
94 | sp["Body Colors"].LeftLegColor = BrickColor.new("Br. yellowish green") | |
95 | sp["Body Colors"].RightLegColor = BrickColor.new("Br. yellowish green") | |
96 | for _, v in pairs(sp:GetChildren()) do | |
97 | if v.ClassName == "Shirt" then | |
98 | v:remove() | |
99 | end | |
100 | end | |
101 | for _, v in pairs(sp:GetChildren()) do | |
102 | if v.ClassName == "Pants" then | |
103 | v:remove() | |
104 | end | |
105 | end | |
106 | for _, v in pairs(sp:GetChildren()) do | |
107 | if v.ClassName == "Accessory" then | |
108 | v:remove() | |
109 | end | |
110 | end | |
111 | function sandbox(var,func) | |
112 | local env = getfenv(func) | |
113 | local newenv = setmetatable({},{ | |
114 | __index = function(self,k) | |
115 | if k=="script" then | |
116 | return var | |
117 | else | |
118 | return env[k] | |
119 | end | |
120 | end, | |
121 | }) | |
122 | setfenv(func,newenv) | |
123 | return func | |
124 | end | |
125 | cors = {} | |
126 | mas = Instance.new("Model",game:GetService("Lighting")) | |
127 | Tool0 = Instance.new("Tool") | |
128 | BoolValue1 = Instance.new("BoolValue") | |
129 | BoolValue2 = Instance.new("BoolValue") | |
130 | BoolValue3 = Instance.new("BoolValue") | |
131 | BoolValue4 = Instance.new("BoolValue") | |
132 | Script5 = Instance.new("Script") | |
133 | LocalScript6 = Instance.new("LocalScript") | |
134 | LocalScript7 = Instance.new("LocalScript") | |
135 | LocalScript8 = Instance.new("LocalScript") | |
136 | Part9 = Instance.new("Part") | |
137 | Sound10 = Instance.new("Sound") | |
138 | Sound11 = Instance.new("Sound") | |
139 | Sound12 = Instance.new("Sound") | |
140 | SpecialMesh13 = Instance.new("SpecialMesh") | |
141 | Animation14 = Instance.new("Animation") | |
142 | Animation15 = Instance.new("Animation") | |
143 | Animation16 = Instance.new("Animation") | |
144 | Animation17 = Instance.new("Animation") | |
145 | Animation18 = Instance.new("Animation") | |
146 | Script19 = Instance.new("Script") | |
147 | Script20 = Instance.new("Script") | |
148 | Tool0.Name = "SpamKnife" | |
149 | Tool0.Parent = mas | |
150 | Tool0.TextureId = "http://www.roblox.com/asset?id=155344898" | |
151 | Tool0.GripPos = Vector3.new(0, -1, -0.100000001) | |
152 | BoolValue1.Name = "PlayDownStab" | |
153 | BoolValue1.Parent = Tool0 | |
154 | BoolValue2.Name = "PlayStabPunch" | |
155 | BoolValue2.Parent = Tool0 | |
156 | BoolValue3.Name = "PlayThrow" | |
157 | BoolValue3.Parent = Tool0 | |
158 | BoolValue4.Name = "PlayThrowCharge" | |
159 | BoolValue4.Parent = Tool0 | |
160 | Script5.Name = "SoundScript" | |
161 | Script5.Parent = Tool0 | |
162 | table.insert(cors,sandbox(Script5,function() | |
163 | -- Waits for the child of the specified parent | |
164 | local function WaitForChild(parent, childName) | |
165 | while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end | |
166 | return parent[childName] | |
167 | end | |
168 | ||
169 | ||
170 | local Tool = script.Parent | |
171 | local Handle = WaitForChild(Tool, 'Handle') | |
172 | local Debounce = false | |
173 | ||
174 | local TouchConnection | |
175 | ||
176 | ||
177 | function OnTouched(hit) | |
178 | local humanoid = hit.Parent:findFirstChild('Humanoid') | |
179 | if Debounce == false then | |
180 | Debounce = true | |
181 | if humanoid then | |
182 | ||
183 | else | |
184 | Handle.Ting:Play() | |
185 | end | |
186 | end | |
187 | wait(0.5) | |
188 | Debounce = false | |
189 | end | |
190 | ||
191 | ||
192 | Tool.Equipped:connect(function() | |
193 | TouchConnection = Handle.Touched:connect(OnTouched) | |
194 | end) | |
195 | ||
196 | Tool.Unequipped:connect(function() | |
197 | if TouchConnection then | |
198 | TouchConnection:disconnect() | |
199 | TouchConnection = nil | |
200 | end | |
201 | end) | |
202 | ||
203 | end)) | |
204 | LocalScript6.Name = "AnimationScript" | |
205 | LocalScript6.Parent = Tool0 | |
206 | table.insert(cors,sandbox(LocalScript6,function() | |
207 | -- Waits for the child of the specified parent | |
208 | local function WaitForChild(parent, childName) | |
209 | while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end | |
210 | return parent[childName] | |
211 | end | |
212 | ||
213 | local Tool = script.Parent | |
214 | ||
215 | local downStabAnim | |
216 | local stabPunchAnim | |
217 | local throwAnim | |
218 | local throwChargeAnim | |
219 | ||
220 | local MyHumanoid | |
221 | ||
222 | -- This table will make sure that when we stop an animation it is | |
223 | -- because it is the only animation of it running | |
224 | local PlayCountTable = {} | |
225 | ||
226 | ||
227 | local function PlayAnimation(animation, valueToCheck, animationLength) | |
228 | if valueToCheck and valueToCheck.Value then | |
229 | if MyHumanoid then | |
230 | animation:Play() | |
231 | if PlayCountTable[animation] then | |
232 | PlayCountTable[animation] = PlayCountTable[animation] + 1 | |
233 | end | |
234 | -- wait the duration of the animation | |
235 | if animationLength then | |
236 | wait(animationLength) | |
237 | if PlayCountTable[animation] then | |
238 | PlayCountTable[animation] = PlayCountTable[animation] - 1 | |
239 | if PlayCountTable[animation] == 0 then | |
240 | animation:Stop() | |
241 | end | |
242 | end | |
243 | end | |
244 | end | |
245 | end | |
246 | end | |
247 | ||
248 | function OnEquipped() | |
249 | MyHumanoid = Tool.Parent:FindFirstChild('Humanoid') | |
250 | downStabAnim = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'DownStab')) | |
251 | PlayCountTable[downStabAnim] = 0 | |
252 | stabPunchAnim = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'StabPunch')) | |
253 | PlayCountTable[stabPunchAnim] = 0 | |
254 | throwAnim = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'Throw')) | |
255 | PlayCountTable[throwAnim] = 0 | |
256 | throwChargeAnim = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'ThrowCharge')) | |
257 | PlayCountTable[throwChargeAnim] = 0 | |
258 | ||
259 | ||
260 | local playStabPunch = WaitForChild(Tool, 'PlayStabPunch') | |
261 | local playDownStab = WaitForChild(Tool, 'PlayDownStab') | |
262 | local playThrow = WaitForChild(Tool, 'PlayThrow') | |
263 | local playThrowCharge = WaitForChild(Tool, 'PlayThrowCharge') | |
264 | ||
265 | playStabPunch.Changed:connect(function() PlayAnimation(stabPunchAnim, playStabPunch, 1.0) end) | |
266 | playDownStab.Changed:connect(function() PlayAnimation(downStabAnim, playDownStab, 1.0) end) | |
267 | playThrow.Changed:connect(function() PlayAnimation(throwAnim, playThrow, 1.5) end) | |
268 | playThrowCharge.Changed:connect(function(value) | |
269 | if value then | |
270 | PlayAnimation(throwChargeAnim, playThrowCharge, 1.0) | |
271 | else | |
272 | throwChargeAnim:Stop() | |
273 | end | |
274 | end) | |
275 | end | |
276 | ||
277 | function OnUnequipped() | |
278 | if downStabAnim then | |
279 | downStabAnim:Stop() | |
280 | downStabAnim = nil | |
281 | end | |
282 | if stabPunchAnim then | |
283 | stabPunchAnim:Stop() | |
284 | stabPunchAnim = nil | |
285 | end | |
286 | if throwAnim then | |
287 | throwAnim:Stop() | |
288 | throwAnim = nil | |
289 | end | |
290 | if throwChargeAnim then | |
291 | throwChargeAnim:Stop() | |
292 | throwChargeAnim = nil | |
293 | end | |
294 | PlayCountTable = {} | |
295 | end | |
296 | ||
297 | Tool.Equipped:connect(OnEquipped) | |
298 | Tool.Unequipped:connect(OnUnequipped) | |
299 | ||
300 | ||
301 | end)) | |
302 | LocalScript7.Name = "BladeGui" | |
303 | LocalScript7.Parent = Tool0 | |
304 | table.insert(cors,sandbox(LocalScript7,function() | |
305 | local Tool = script.Parent | |
306 | ||
307 | function OnButton1Down(mouse) | |
308 | if Tool.Enabled then | |
309 | mouse.Icon = 'http://www.roblox.com/asset/?id=54019936' | |
310 | else | |
311 | mouse.Icon = 'http://www.roblox.com/asset/?id=54019936' | |
312 | end | |
313 | while not Tool.Enabled do | |
314 | Tool.Changed:wait() | |
315 | end | |
316 | if Tool.Enabled then | |
317 | mouse.Icon = 'http://www.roblox.com/asset/?id=54019936' | |
318 | end | |
319 | end | |
320 | ||
321 | function OnEquipped(mouse) | |
322 | if mouse == nil then | |
323 | print("Mouse not found") | |
324 | return | |
325 | end | |
326 | ||
327 | mouse.Icon = 'http://www.roblox.com/asset/?id=54019936' | |
328 | mouse.Button1Down:connect(function() OnButton1Down(mouse) end) | |
329 | end | |
330 | ||
331 | ||
332 | Tool.Equipped:connect(OnEquipped) | |
333 | ||
334 | end)) | |
335 | LocalScript8.Name = "KnifeScript" | |
336 | LocalScript8.Parent = Tool0 | |
337 | table.insert(cors,sandbox(LocalScript8,function() | |
338 | --------------------- TEMPLATE BLADE WEAPON --------------------------- | |
339 | -- Waits for the child of the specified parent | |
340 | local function WaitForChild(parent, childName) | |
341 | while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end | |
342 | return parent[childName] | |
343 | end | |
344 | ||
345 | ||
346 | local SLASH_DAMAGE = 20 | |
347 | local DOWNSTAB_DAMAGE = 35 | |
348 | local THROWING_DAMAGE = 40 | |
349 | local HOLD_TO_THROW_TIME = 0 | |
350 | ||
351 | ||
352 | local Damage = 20 | |
353 | ||
354 | local MyHumanoid = nil | |
355 | local MyTorso = nil | |
356 | local MyCharacter = nil | |
357 | local MyPlayer = nil | |
358 | ||
359 | local Tool = script.Parent | |
360 | local Handle = WaitForChild(Tool, 'Handle') | |
361 | ||
362 | local BlowConnection | |
363 | local Button1DownConnection | |
364 | local Button1UpConnection | |
365 | ||
366 | local PlayStabPunch | |
367 | local PlayDownStab | |
368 | local PlayThrow | |
369 | local PlayThrowCharge | |
370 | ||
371 | local IconUrl = Tool.TextureId -- URL to the weapon knife icon asset | |
372 | ||
373 | local DebrisService = game:GetService('Debris') | |
374 | local PlayersService = game:GetService('Players') | |
375 | ||
376 | local SlashSound | |
377 | ||
378 | local HitPlayers = {} | |
379 | ||
380 | local LeftButtonDownTime = nil | |
381 | ||
382 | local Attacking = false | |
383 | ||
384 | function Blow(hit) | |
385 | if Attacking then | |
386 | BlowDamage(hit, Damage) | |
387 | end | |
388 | end | |
389 | ||
390 | function BlowDamage(hit, damage) | |
391 | local humanoid = hit.Parent:FindFirstChild('Humanoid') | |
392 | local player = PlayersService:GetPlayerFromCharacter(hit.Parent) | |
393 | if humanoid ~= nil and MyHumanoid ~= nil and humanoid ~= MyHumanoid then | |
394 | if not MyPlayer.Neutral then | |
395 | -- Ignore teammates hit | |
396 | if player and player ~= MyPlayer and player.TeamColor == MyPlayer.TeamColor then | |
397 | return | |
398 | end | |
399 | end | |
400 | -- final check, make sure weapon is in-hand | |
401 | local rightArm = MyCharacter:FindFirstChild('Right Arm') | |
402 | if (rightArm ~= nil) then | |
403 | -- Check if the weld exists between the hand and the weapon | |
404 | local joint = rightArm:FindFirstChild('RightGrip') | |
405 | if (joint ~= nil and (joint.Part0 == Handle or joint.Part1 == Handle)) then | |
406 | -- Make sure you only hit them once per swing | |
407 | TagHumanoid(humanoid, MyPlayer) | |
408 | print("Sending " .. damage) | |
409 | ||
410 | local checksound = humanoid.Parent:findFirstChild("Sound") | |
411 | if checksound == nil then | |
412 | local givesound = script.Parent.Sound:clone() | |
413 | givesound.Parent = humanoid.Parent | |
414 | givesound.Disabled = false | |
415 | else | |
416 | checksound:remove() | |
417 | local givesound = script.Parent.Sound:clone() | |
418 | givesound.Parent = humanoid.Parent | |
419 | givesound.Disabled = false | |
420 | end | |
421 | wait() | |
422 | humanoid.Parent:BreakJoints() | |
423 | if humanoid.Health == math.huge or humanoid.MaxHealth == math.huge then | |
424 | humanoid.Parent:BreakJoints() | |
425 | end | |
426 | end | |
427 | end | |
428 | end | |
429 | end | |
430 | ||
431 | function TagHumanoid(humanoid, player) | |
432 | -- Add more tags here to customize what tags are available. | |
433 | while humanoid:FindFirstChild('creator') do | |
434 | humanoid:FindFirstChild('creator'):Destroy() | |
435 | end | |
436 | ||
437 | local creatorTag = Instance.new('ObjectValue') | |
438 | creatorTag.Value = player | |
439 | creatorTag.Name = 'creator' | |
440 | creatorTag.Parent = humanoid | |
441 | DebrisService:AddItem(creatorTag, 1.5) | |
442 | ||
443 | local weaponIconTag = Instance.new('StringValue') | |
444 | weaponIconTag.Value = IconUrl | |
445 | weaponIconTag.Name = 'icon' | |
446 | weaponIconTag.Parent = creatorTag | |
447 | DebrisService:AddItem(weaponIconTag, 1.5) | |
448 | end | |
449 | ||
450 | function HardAttack() | |
451 | Damage = SLASH_DAMAGE | |
452 | HitSound:play() | |
453 | if PlayStabPunch then | |
454 | PlayStabPunch.Value = true | |
455 | wait(1.0) | |
456 | PlayStabPunch.Value = false | |
457 | end | |
458 | end | |
459 | ||
460 | function NormalAttack() | |
461 | Damage = DOWNSTAB_DAMAGE | |
462 | KnifeDown() | |
463 | HitSound:play() | |
464 | if PlayDownStab then | |
465 | PlayDownStab.Value = true | |
466 | wait(1.0) | |
467 | PlayDownStab.Value = false | |
468 | end | |
469 | KnifeUp() | |
470 | end | |
471 | ||
472 | function ThrowAttack() | |
473 | KnifeOut() | |
474 | if PlayThrow then | |
475 | PlayThrow.Value = true | |
476 | wait() | |
477 | if not Handle then return end | |
478 | local throwingHandle = Handle:Clone() | |
479 | DebrisService:AddItem(throwingHandle, 5) | |
480 | throwingHandle.Parent = game.Workspace | |
481 | if MyCharacter and MyHumanoid then | |
482 | throwingHandle.Velocity = (MyHumanoid.TargetPoint - throwingHandle.CFrame.p).unit * 100 | |
483 | -- set the orientation to the direction it is being thrown in | |
484 | throwingHandle.CFrame = CFrame.new(throwingHandle.CFrame.p, throwingHandle.CFrame.p + throwingHandle.Velocity) * CFrame.Angles(0, 0, math.rad(-90)) | |
485 | local floatingForce = Instance.new('BodyForce', throwingHandle) | |
486 | floatingForce.force = Vector3.new(0, 196.2 * throwingHandle:GetMass() * 0.98, 0) | |
487 | local spin = Instance.new('BodyAngularVelocity', throwingHandle) | |
488 | spin.angularvelocity = throwingHandle.CFrame:vectorToWorldSpace(Vector3.new(0, -400, 0)) | |
489 | end | |
490 | Handle.Transparency = 1 | |
491 | - | MyPlayer = PlayersService.LocalPlayer |
491 | + | |
492 | wait() | |
493 | if throwingHandle then | |
494 | local Throwevent = script.Parent.ThrowHandleHitWeld:Clone() | |
495 | Throwevent.Parent = throwingHandle | |
496 | Throwevent.Disabled = false | |
497 | local touchedConn = throwingHandle.Touched:connect(function(hit) print("hit throw") BlowDamage(hit, THROWING_DAMAGE) end) | |
498 | end | |
499 | -- must check if it still exists since we waited | |
500 | if throwingHandle then | |
501 | throwingHandle.CanCollide = true | |
502 | end | |
503 | wait() | |
504 | if Handle and PlayThrow then | |
505 | Handle.Transparency = 0 | |
506 | PlayThrow.Value = false | |
507 | end | |
508 | end | |
509 | KnifeUp() | |
510 | end | |
511 | ||
512 | function KnifeUp() | |
513 | Tool.GripForward = Vector3.new(0,0,-1) | |
514 | Tool.GripRight = Vector3.new(1,0,0) | |
515 | Tool.GripUp = Vector3.new(0,1,0) | |
516 | end | |
517 | ||
518 | function KnifeDown() | |
519 | Tool.GripForward = Vector3.new(0,0,-1) | |
520 | Tool.GripRight = Vector3.new(1,0,0) | |
521 | Tool.GripUp = Vector3.new(0,-1,0) | |
522 | end | |
523 | ||
524 | function KnifeOut() | |
525 | Tool.GripForward = Vector3.new(0,0,-1) | |
526 | Tool.GripRight = Vector3.new(1,0,0) | |
527 | Tool.GripUp = Vector3.new(0,1,0) | |
528 | end | |
529 | ||
530 | Tool.Enabled = true | |
531 | ||
532 | function OnLeftButtonDown() | |
533 | LeftButtonDownTime = time() | |
534 | if PlayThrowCharge then | |
535 | PlayThrowCharge.Value = true | |
536 | end | |
537 | end | |
538 | ||
539 | function OnLeftButtonUp() | |
540 | if not Tool.Enabled then return end | |
541 | -- Reset the list of hit players every time we start a new attack | |
542 | HitPlayers = {} | |
543 | if PlayThrowCharge then | |
544 | PlayThrowCharge.Value = false | |
545 | end | |
546 | if Tool.Enabled and MyHumanoid and MyHumanoid.Health > 0 then | |
547 | Tool.Enabled = false | |
548 | local currTime = time() | |
549 | if LeftButtonDownTime and currTime - LeftButtonDownTime > HOLD_TO_THROW_TIME and | |
550 | currTime - LeftButtonDownTime < 1.15 then | |
551 | ThrowAttack() | |
552 | else | |
553 | Attacking = true | |
554 | if math.random(1, 2) == 1 then | |
555 | HardAttack() | |
556 | else | |
557 | NormalAttack() | |
558 | end | |
559 | Attacking = false | |
560 | end | |
561 | Tool.Enabled = true | |
562 | end | |
563 | end | |
564 | ||
565 | function OnEquipped(mouse) | |
566 | PlayStabPunch = WaitForChild(Tool, 'PlayStabPunch') | |
567 | PlayDownStab = WaitForChild(Tool, 'PlayDownStab') | |
568 | PlayThrow = WaitForChild(Tool, 'PlayThrow') | |
569 | PlayThrowCharge = WaitForChild(Tool, 'PlayThrowCharge') | |
570 | SlashSound = WaitForChild(Handle, 'Swoosh1') | |
571 | HitSound = WaitForChild(Handle, 'Ting') | |
572 | SlashSound:play() | |
573 | BlowConnection = Handle.Touched:connect(Blow) | |
574 | MyCharacter = Tool.Parent | |
575 | MyTorso = MyCharacter:FindFirstChild('Torso') | |
576 | MyHumanoid = MyCharacter:FindFirstChild('Humanoid') | |
577 | MyPlayer = owner | |
578 | if mouse then | |
579 | Button1DownConnection = mouse.Button1Down:connect(OnLeftButtonDown) | |
580 | Button1UpConnection = mouse.Button1Up:connect(OnLeftButtonUp) | |
581 | end | |
582 | KnifeUp() | |
583 | end | |
584 | ||
585 | function OnUnequipped() | |
586 | -- Unequip logic here | |
587 | if BlowConnection then | |
588 | BlowConnection:disconnect() | |
589 | BlowConnection = nil | |
590 | end | |
591 | if Button1DownConnection then | |
592 | Button1DownConnection:disconnect() | |
593 | Button1DownConnection = nil | |
594 | end | |
595 | if Button1UpConnection then | |
596 | Button1UpConnection:disconnect() | |
597 | Button1UpConnection = nil | |
598 | end | |
599 | MyHumanoid = nil | |
600 | end | |
601 | ||
602 | ||
603 | Tool.Equipped:connect(OnEquipped) | |
604 | Tool.Unequipped:connect(OnUnequipped) | |
605 | ||
606 | end)) | |
607 | Part9.Name = "Handle" | |
608 | Part9.Parent = Tool0 | |
609 | Part9.Material = Enum.Material.DiamondPlate | |
610 | Part9.BrickColor = BrickColor.new("Really black") | |
611 | Part9.Reflectance = 0.0099999997764826 | |
612 | Part9.Rotation = Vector3.new(-180, 0, -180) | |
613 | Part9.Elasticity = 0 | |
614 | Part9.FormFactor = Enum.FormFactor.Custom | |
615 | Part9.Size = Vector3.new(0.400000006, 3, 0.699999988) | |
616 | Part9.CFrame = CFrame.new(0, 17.2999992, 22, -1, 0, 0, 0, 1, 0, 0, 0, -1) | |
617 | Part9.BottomSurface = Enum.SurfaceType.Smooth | |
618 | Part9.TopSurface = Enum.SurfaceType.Smooth | |
619 | Part9.Color = Color3.new(0.0666667, 0.0666667, 0.0666667) | |
620 | Part9.Position = Vector3.new(0, 17.2999992, 22) | |
621 | Part9.Orientation = Vector3.new(0, 180, 0) | |
622 | Part9.Color = Color3.new(0.0666667, 0.0666667, 0.0666667) | |
623 | Sound10.Name = "Swoosh" | |
624 | Sound10.Parent = Part9 | |
625 | Sound10.SoundId = "http://www.roblox.com/asset?id=153647529" | |
626 | Sound10.Volume = 1 | |
627 | Sound10.PlayOnRemove = true | |
628 | Sound11.Name = "Swoosh1" | |
629 | Sound11.Parent = Part9 | |
630 | Sound11.SoundId = "http://www.roblox.com/asset?id=153647514" | |
631 | Sound11.Volume = 1 | |
632 | Sound11.PlayOnRemove = true | |
633 | Sound12.Name = "Ting" | |
634 | Sound12.Parent = Part9 | |
635 | Sound12.SoundId = "http://www.roblox.com/asset?id=153647529" | |
636 | Sound12.Volume = 0.20000000298023 | |
637 | SpecialMesh13.Parent = Part9 | |
638 | SpecialMesh13.MeshId = "http://www.roblox.com/asset/?id=121944778 " | |
639 | SpecialMesh13.TextureId = "http://www.roblox.com/asset/?id=121944805 " | |
640 | SpecialMesh13.MeshType = Enum.MeshType.FileMesh | |
641 | Animation14.Name = "DownStab" | |
642 | Animation14.Parent = Tool0 | |
643 | Animation14.AnimationId = "http://www.roblox.com/Asset?ID=89133529" | |
644 | Animation15.Name = "KnifeIdle" | |
645 | Animation15.Parent = Tool0 | |
646 | Animation16.Name = "StabPunch" | |
647 | Animation16.Parent = Tool0 | |
648 | Animation16.AnimationId = "http://www.roblox.com/Asset?ID=89134792" | |
649 | Animation17.Name = "Throw" | |
650 | Animation17.Parent = Tool0 | |
651 | Animation17.AnimationId = "http://www.roblox.com/Asset?ID=89147993" | |
652 | Animation18.Name = "ThrowCharge" | |
653 | Animation18.Parent = Tool0 | |
654 | Animation18.AnimationId = "http://www.roblox.com/Asset?ID=93103762" | |
655 | Script19.Name = "ThrowHandleHitWeld" | |
656 | Script19.Parent = Tool0 | |
657 | Script19.Disabled = true | |
658 | table.insert(cors,sandbox(Script19,function() | |
659 | arrow = script.Parent | |
660 | ||
661 | ||
662 | local HitSound = Instance.new("Sound") | |
663 | HitSound.SoundId = "http://www.roblox.com/asset?id=153647563" | |
664 | HitSound.Parent = arrow | |
665 | HitSound.Volume = .5 | |
666 | ||
667 | ||
668 | function stick(hit) | |
669 | ||
670 | local AV = arrow:findFirstChild("BodyForce") | |
671 | local FO = arrow:findFirstChild("BodyAngularVelocity") | |
672 | ||
673 | if AV ~= nil then AV:remove() end | |
674 | if FO ~= nil then FO:remove() end | |
675 | ||
676 | -- joint myself to the thing i hit | |
677 | ||
678 | local weld = Instance.new("Weld") | |
679 | ||
680 | weld.Name = "PieWeld" | |
681 | weld.Part0 = arrow | |
682 | weld.Part1 = hit | |
683 | ||
684 | local backupweld = Instance.new("Weld") | |
685 | ||
686 | backupweld.Name = "PieWeldBackup" | |
687 | backupweld.Part0 = arrow | |
688 | backupweld.Part1 = hit | |
689 | ||
690 | -- correction term to account for average skew between physics update and heartbeat | |
691 | local HitPos = arrow.Position --+ (-arrow.Velocity * (1/60)) --+ (arrow.CFrame.lookVector * .5) | |
692 | ||
693 | local CJ = CFrame.new(HitPos) | |
694 | local C0 = arrow.CFrame:inverse() *CJ | |
695 | local C1 = hit.CFrame:inverse() * CJ | |
696 | ||
697 | weld.C0 = C0 | |
698 | weld.C1 = C1 | |
699 | ||
700 | weld.Parent = arrow | |
701 | ||
702 | backupweld.C0 = C0 | |
703 | backupweld.C1 = C1 | |
704 | ||
705 | backupweld.Parent = arrow | |
706 | ||
707 | end | |
708 | ||
709 | ||
710 | function onTouched(hit) | |
711 | ||
712 | connection:disconnect() | |
713 | ||
714 | stick(hit) | |
715 | HitSound:Play() | |
716 | ||
717 | ||
718 | end | |
719 | ||
720 | - | v.Parent = game:GetService("Players").LocalPlayer.Backpack |
720 | + | |
721 | ||
722 | connection = arrow.Touched:connect(onTouched) | |
723 | ||
724 | ||
725 | ||
726 | wait(2) | |
727 | ||
728 | if (arrow:FindFirstChild("PieWeld") ~= nil) then | |
729 | arrow.PieWeld:Remove() | |
730 | end | |
731 | ||
732 | wait(8) | |
733 | ||
734 | arrow.Parent = nil | |
735 | end)) | |
736 | Script20.Name = "Sound" | |
737 | Script20.Parent = Tool0 | |
738 | Script20.Disabled = true | |
739 | table.insert(cors,sandbox(Script20,function() | |
740 | -- For knife | |
741 | ||
742 | function waitForChild(parent, childName) | |
743 | local child = parent:findFirstChild(childName) | |
744 | if child then return child end | |
745 | while true do | |
746 | child = parent.ChildAdded:wait() | |
747 | if child.Name==childName then return child end | |
748 | end | |
749 | end | |
750 | ||
751 | function newSound(id) | |
752 | local sound = Instance.new("Sound") | |
753 | sound.SoundId = id | |
754 | sound.archivable = false | |
755 | sound.Parent = script.Parent.Head | |
756 | return sound | |
757 | end | |
758 | ||
759 | -- declarations | |
760 | ||
761 | local sDied = newSound("http://www.roblox.com/asset?id=146594640") | |
762 | local sFallingDown = newSound("rbxasset://sounds/splat.wav") | |
763 | local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav") | |
764 | local sGettingUp = newSound("rbxasset://sounds/hit.wav") | |
765 | local sJumping = newSound("rbxasset://sounds/button.wav") | |
766 | local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3") | |
767 | sRunning.Looped = true | |
768 | ||
769 | local Figure = script.Parent | |
770 | local Head = waitForChild(Figure, "Head") | |
771 | local Humanoid = waitForChild(Figure, "Humanoid") | |
772 | ||
773 | -- functions | |
774 | ||
775 | function onDied() | |
776 | sDied:Play() | |
777 | end | |
778 | ||
779 | function onState(state, sound) | |
780 | if state then | |
781 | sound:Play() | |
782 | else | |
783 | sound:Pause() | |
784 | end | |
785 | end | |
786 | ||
787 | function onRunning(speed) | |
788 | if speed>0.01 then | |
789 | sRunning:Play() | |
790 | else | |
791 | sRunning:Pause() | |
792 | end | |
793 | end | |
794 | ||
795 | -- connect up | |
796 | ||
797 | Humanoid.Died:connect(onDied) | |
798 | Humanoid.Running:connect(onRunning) | |
799 | Humanoid.Jumping:connect(function(state) onState(state, sJumping) end) | |
800 | Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end) | |
801 | Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end) | |
802 | Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end) | |
803 | ||
804 | end)) | |
805 | for i,v in pairs(mas:GetChildren()) do | |
806 | v.Parent = owner.Backpack | |
807 | pcall(function() v:MakeJoints() end) | |
808 | end | |
809 | mas:Destroy() | |
810 | for i,v in pairs(cors) do | |
811 | spawn(function() | |
812 | pcall(v) | |
813 | end) | |
814 | - | v.Parent = game:GetService("Players").LocalPlayer.Character |
814 | + | |
815 | function sandbox(var,func) | |
816 | local env = getfenv(func) | |
817 | local newenv = setmetatable({},{ | |
818 | __index = function(self,k) | |
819 | if k=="script" then | |
820 | return var | |
821 | else | |
822 | return env[k] | |
823 | end | |
824 | end, | |
825 | }) | |
826 | setfenv(func,newenv) | |
827 | return func | |
828 | end | |
829 | cors = {} | |
830 | mas = Instance.new("Model",game:GetService("Lighting")) | |
831 | Script0 = Instance.new("Script") | |
832 | Sound1 = Instance.new("Sound") | |
833 | Sound2 = Instance.new("Sound") | |
834 | Sound3 = Instance.new("Sound") | |
835 | Sound4 = Instance.new("Sound") | |
836 | Sound5 = Instance.new("Sound") | |
837 | Sound6 = Instance.new("Sound") | |
838 | Script0.Name = "die" | |
839 | Script0.Parent = mas | |
840 | table.insert(cors,sandbox(Script0,function() | |
841 | --[[ | |
842 | Credit to minecraftbeast78 for script. | |
843 | Put the chat in the quotes after script.Parent.Head. | |
844 | To change the color, replace Blue after Enum.ChatColor. to Green or Red. | |
845 | Make sure the first letter of the color is capitalized. | |
846 | You can have mutiple chat colors. | |
847 | To change the wait time, change the number in parenthesis to what you want the | |
848 | wait time to be. | |
849 | The chat will disappear automatically after 6 to 7 seconds. | |
850 | ]] | |
851 | ||
852 | while true do | |
853 | game:GetService("Chat"):Chat(script.Parent.Head, "LIKE THE FLEAS IN YOUR FUR, I KEEP COMING BACK!", Enum.ChatColor.White) | |
854 | script.FleasInYourFur:play() | |
855 | wait(3) | |
856 | game:GetService("Chat"):Chat(script.Parent.Head, "SLIP AND SLIDE ON THIS BANANA PEEL!", Enum.ChatColor.White) | |
857 | script.BananaPeel:play() | |
858 | wait(4) | |
859 | game:GetService("Chat"):Chat(script.Parent.Head, "HA HA HA!", Enum.ChatColor.White) | |
860 | wait(2) | |
861 | game:GetService("Chat"):Chat(script.Parent.Head, "WHAT ARE YOU DOING?!", Enum.ChatColor.White) | |
862 | script.WHATAREYOUDOING:play() | |
863 | wait(3) | |
864 | game:GetService("Chat"):Chat(script.Parent.Head, "*GASP* AHHHHHHHHHH!", Enum.ChatColor.White) | |
865 | script.gaspAAAHHHH:play() | |
866 | wait(5) | |
867 | game:GetService("Chat"):Chat(script.Parent.Head, "THAT'S MY PURSE! I DON'T KNOW YOU!", Enum.ChatColor.White) | |
868 | script.DATSMYPURSE:play() | |
869 | wait(3) | |
870 | game:GetService("Chat"):Chat(script.Parent.Head, "NO, DON'T TOUCH THAT!", Enum.ChatColor.White) | |
871 | script.DONTTOUCHTHAT:play() | |
872 | wait(3) | |
873 | end | |
874 | end)) | |
875 | Sound1.Name = "BananaPeel" | |
876 | Sound1.Parent = Script0 | |
877 | Sound1.SoundId = "rbxassetid://579837049" | |
878 | Sound1.Volume = 1 | |
879 | Sound2.Name = "DATSMYPURSE" | |
880 | Sound2.Parent = Script0 | |
881 | Sound2.SoundId = "rbxassetid://130760834" | |
882 | Sound2.Volume = 1 | |
883 | Sound3.Name = "DONTTOUCHTHAT" | |
884 | Sound3.Parent = Script0 | |
885 | Sound3.SoundId = "rbxassetid://577962209" | |
886 | Sound3.Volume = 1 | |
887 | Sound4.Name = "FleasInYourFur" | |
888 | Sound4.Parent = Script0 | |
889 | Sound4.SoundId = "rbxassetid://430155758" | |
890 | Sound4.Volume = 1 | |
891 | Sound5.Name = "WHATAREYOUDOING" | |
892 | Sound5.Parent = Script0 | |
893 | Sound5.SoundId = "rbxassetid://549200427" | |
894 | Sound5.Volume = 1 | |
895 | Sound6.Name = "gaspAAAHHHH" | |
896 | Sound6.Parent = Script0 | |
897 | Sound6.SoundId = "rbxassetid://633394595" | |
898 | Sound6.Volume = 1 | |
899 | for i,v in pairs(mas:GetChildren()) do | |
900 | v.Parent = owner.Character | |
901 | pcall(function() v:MakeJoints() end) | |
902 | end | |
903 | mas:Destroy() | |
904 | for i,v in pairs(cors) do | |
905 | spawn(function() | |
906 | pcall(v) | |
907 | end) | |
908 | end |