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