· 6 years ago · Oct 06, 2019, 11:00 PM
1
2--Converted with ttyyuu12345's model to script plugin v4
3function sandbox(var,func)
4 local env = getfenv(func)
5 local newenv = setmetatable({},{
6 __index = function(self,k)
7 if k=="script" then
8 return var
9 else
10 return env[k]
11 end
12 end,
13 })
14 setfenv(func,newenv)
15 return func
16end
17cors = {}
18mas = Instance.new("Model",game:GetService("Lighting"))
19Tool0 = Instance.new("Tool")
20Part1 = Instance.new("Part")
21Sound2 = Instance.new("Sound")
22Sound3 = Instance.new("Sound")
23Sound4 = Instance.new("Sound")
24Sound5 = Instance.new("Sound")
25SpecialMesh6 = Instance.new("SpecialMesh")
26Sparkles7 = Instance.new("Sparkles")
27Sparkles8 = Instance.new("Sparkles")
28Sparkles9 = Instance.new("Sparkles")
29Sparkles10 = Instance.new("Sparkles")
30Fire11 = Instance.new("Fire")
31Sound12 = Instance.new("Sound")
32LocalScript13 = Instance.new("LocalScript")
33Script14 = Instance.new("Script")
34Animation15 = Instance.new("Animation")
35Animation16 = Instance.new("Animation")
36Animation17 = Instance.new("Animation")
37Animation18 = Instance.new("Animation")
38LocalScript19 = Instance.new("LocalScript")
39Script20 = Instance.new("Script")
40Tool0.Name = "rainbow"
41Tool0.Parent = mas
42Tool0.TextureId = "http://www.roblox.com/asset/?id=72541473"
43Tool0.Grip = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0)
44Tool0.GripForward = Vector3.new(-1, -0, -0)
45Tool0.GripPos = Vector3.new(0, 0, -1.70000005)
46Tool0.GripRight = Vector3.new(0, 1, 0)
47Tool0.GripUp = Vector3.new(0, 0, 1)
48Part1.Name = "Handle"
49Part1.Parent = Tool0
50Part1.CFrame = CFrame.new(-221.490738, 62.8512993, 444.01767, 8.53538513e-05, 0.507240474, 0.861804485, -0.99999994, 0.000165462494, 1.60932541e-06, -0.000141739845, -0.861804485, 0.507240534)
51Part1.Orientation = Vector3.new(0, 59.5200005, -89.9899979)
52Part1.Position = Vector3.new(-221.490738, 62.8512993, 444.01767)
53Part1.Rotation = Vector3.new(0, 59.5200005, -89.9899979)
54Part1.Color = Color3.new(0.388235, 0.372549, 0.384314)
55Part1.Size = Vector3.new(1, 0.800000012, 6)
56Part1.BottomSurface = Enum.SurfaceType.Smooth
57Part1.BrickColor = BrickColor.new("Dark stone grey")
58Part1.Reflectance = 0.40000000596046
59Part1.TopSurface = Enum.SurfaceType.Smooth
60Part1.brickColor = BrickColor.new("Dark stone grey")
61Part1.FormFactor = Enum.FormFactor.Plate
62Part1.formFactor = Enum.FormFactor.Plate
63Sound2.Name = "SOUND_slash"
64Sound2.Parent = Part1
65Sound2.SoundId = "rbxassetid://722744682"
66Sound3.Name = "SOUND_equip"
67Sound3.Parent = Part1
68Sound3.SoundId = "rbxassetid://132073439"
69Sound3.Volume = 10
70Sound4.Name = "SOUND_down"
71Sound4.Parent = Part1
72Sound4.SoundId = "rbxassetid://130781643"
73Sound4.Volume = 10
74Sound5.Name = "SOUND_hitground"
75Sound5.Parent = Part1
76Sound5.SoundId = "rbxassetid://618667795"
77Sound5.Volume = 10
78SpecialMesh6.Parent = Part1
79SpecialMesh6.MeshId = "http://www.roblox.com/asset/?id=15924243"
80SpecialMesh6.Scale = Vector3.new(1.20000005, 1, 1.20000005)
81SpecialMesh6.TextureId = "http://www.roblox.com/asset/?id=836795717"
82SpecialMesh6.MeshType = Enum.MeshType.FileMesh
83Sparkles7.Parent = Part1
84Sparkles8.Parent = Part1
85Sparkles8.Color = Color3.new(1.77083, 3.4, 0)
86Sparkles8.SparkleColor = Color3.new(1, 0.333333, 0)
87Sparkles9.Parent = Part1
88Sparkles9.Color = Color3.new(1.18056, 10.2, 1)
89Sparkles9.SparkleColor = Color3.new(0.666667, 1, 1)
90Sparkles10.Parent = Part1
91Sparkles10.Color = Color3.new(1.77083, 9.48, 0.145098)
92Sparkles10.SparkleColor = Color3.new(1, 0.929412, 0.145098)
93Fire11.Parent = Part1
94Fire11.Color = Color3.new(1, 0, 0)
95Fire11.Heat = 14
96Sound12.Name = "Rainbow"
97Sound12.Parent = Part1
98Sound12.Looped = true
99Sound12.Playing = true
100Sound12.SoundId = "rbxassetid://719818409"
101Sound12.Volume = 2
102LocalScript13.Name = "ChristmasKatana_MainScript"
103LocalScript13.Parent = Tool0
104table.insert(cors,sandbox(LocalScript13,function()
105--local mDebugId = game.Workspace.DebugId.Value
106--game.Workspace.DebugId.Value = game.Workspace.DebugId.Value+1
107--print("Running swordscript <"..mDebugId..">")
108local debris = game:GetService("Debris")
109
110-------------------------------------
111-- Makes an RBX::Lua Instance using
112-- a table of key-value pairs to
113-- initialize it. Values with numeric
114-- keys will be parented to the object
115-- and other values will be set
116-- as members of the object.
117function Create(ty)
118 return function(data)
119 local obj = Instance.new(ty)
120 for k, v in pairs(data) do
121 if type(k) == 'number' then
122 v.Parent = obj
123 else
124 obj[k] = v
125 end
126 end
127 return obj
128 end
129end
130
131---------------------------------------
132-- Same as Make, but modifies an existing
133-- object rather than creating ones.
134function Modify(obj, data)
135 for k, v in pairs(data) do
136 if type(data) == 'number' then
137 data.Parent = obj
138 else
139 data[k] = v
140 end
141 end
142 return obj
143end
144
145-----------------------------------------
146-- Creates a class which can be instantiated
147-- using `CreateCLASSNAME( ... )`.
148---usage:
149--class'MyClass'(function(this, arg1)
150-- this.ClassMember = value
151-- function this.ClassMethod(...) ... end
152--end, function(def)
153-- def.StaticMember = value
154-- function def.StaticMethod(...) ... end
155--end)
156--local obj = CreateMyClass(arg1)
157------------------------------------------
158local function class(name)
159 local def = {}
160 getfenv(0)[name] = def
161 return function(ctor, static)
162 local nctor = function(...)
163 local this = {}
164 if ctor then
165 ctor(this, ...)
166 end
167 return this
168 end
169 getfenv(0)['Create'..name] = nctor
170 if static then static(def) end
171 end
172end
173
174
175---------------------------------------------
176-- Signal class for custom-made events
177--API:
178-- Signal:connect(callback)
179-- Signal:fire(...)
180-- Signal:wait()
181---------------------------------------------
182class'Signal'(function(this)
183 local mListeners = {}
184 local mWaitObject = Create'BoolValue'{}
185
186 function this:connect(func)
187 local connection = {}
188 function connection:disconnect()
189 mListeners[func] = nil
190 end
191 mListeners[func] = connection
192 return connection
193 end
194
195 function this:fire(...)
196 --print("Fire evt<"..tostring(this).."> from script<"..mDebugId..">")
197 for func, conn in pairs(mListeners) do
198 --print("-> "..tostring(func).."( ... )")
199 func(...)
200 end
201 mWaitObject.Value = not mWaitObject.Value
202 end
203
204 function this:wait()
205 mWaitObject.Changed:wait()
206 end
207end)
208
209
210--------------------------------------------------
211-- Bin class for cleaning up assets
212--API:
213-- Bin:add(func: Function, ident: String)
214-- Bin:clean(ident: String)
215-- Bin:cleanAll()
216--------------------------------------------------
217class'Bin'(function(this)
218 local mGarbage = {}
219
220 function this:add(func, ident)
221 ident = ident or '__unnamed'
222 if not mGarbage[ident] then
223 mGarbage[ident] = {}
224 end
225 mGarbage[ident][#mGarbage[ident]+1] = func
226 end
227
228 function this:clean(ident)
229 local listToCall = mGarbage[ident]
230 if listToCall then
231 for _, func in pairs(listToCall) do
232 func()
233 end
234 mGarbage[ident] = nil
235 end
236 end
237
238 function this:cleanAll()
239 for ident, list in pairs(mGarbage) do
240 for _, func in pairs(list) do
241 func()
242 end
243 mGarbage[ident] = nil
244 end
245 end
246end)
247
248
249-----------------------------------------------------
250-- AnimationProvider class for easy loading of
251-- animation assets into animationtracks once
252-- a humanoid is available.
253--API:
254-- AnimationProvider:registerAnimation(ident, assetid)
255-- AnimationProvider:setHumanoid(humanoid)
256-- AnimationProvider:setTool(tool)
257-- AnimationProvider:getAnimation(ident)
258-----------------------------------------------------
259class'AnimationProvider'(function(this)
260 local mAnimations = {--[[ident => {AnimationId, CurrentTrack, CurrentAnim} ]]}
261 local mCurrentHumanoid = nil
262
263 function this:registerAnimation(ident, assetid)
264 --check for an existing copy of the anim
265 local existingAnim = Tool.Tool:FindFirstChild('ANIM_'..ident)
266
267 --make the data for this anim
268 local animdat = {
269 AnimationId = assetid,
270 CurrentAnim = existingAnim or Create'Animation'{
271 Name = "ANIM_"..ident,
272 AnimationId = assetid,
273 },
274 }
275 mAnimations[ident] = animdat
276
277 --if there's a current tool, put it in there
278 if Tool.Tool then
279 Tool.HUGE_EQUIP_HACK = true
280 animdat.CurrentAnim.Parent = Tool.Tool
281 Tool.HUGE_EQUIP_HACK = false
282 end
283
284 --if there's a humanoid load the animation track
285 if mCurrentHumanoid then
286 animdat.CurrentTrack = mCurrentHumanoid:LoadAnimation(animdat.CurrentAnim)
287 end
288 end
289
290 function this:setHumanoid(humanoid)
291 mCurrentHumanoid = humanoid
292 for _, anim in pairs(mAnimations) do
293 anim.CurrentTrack = humanoid:LoadAnimation(anim.CurrentAnim)
294 end
295 end
296
297 function this:getAnimation(ident)
298 local dat = mAnimations[ident]
299 if not dat then error("Gear Fatal Error: Animation `"..ident.."` not found") end
300 if not dat.CurrentTrack then
301 error("Gear Fatal Error: No Humanoid for animation `"..ident.."` to run in")
302 end
303 return dat.CurrentTrack
304 end
305end)
306
307
308----------------------------------------------
309-- SoundProvider class
310-- functions similarily to the animationprovider
311----------------------------------------------
312class'SoundProvider'(function(this)
313 local mSounds = {}
314
315 function this:registerSound(ident, assetid, inpart)
316 inpart = inpart or Tool.Tool:FindFirstChild('Handle')
317 if not inpart then
318 repeat
319 inpart = Tool.Tool.ChildAdded:wait()
320 until inpart.Name == 'Handle'
321 end
322 local existingSound = inpart:FindFirstChild('SOUND_'..ident)
323 local sounddat = {
324 SoundId = assetid,
325 CurrentSound = existingSound or Create'Sound'{
326 Name = 'SOUND_'..ident,
327 SoundId = assetid,
328 Parent = inpart,
329 },
330 }
331 mSounds[ident] = sounddat
332 end
333
334 function this:getSound(ident)
335 local dat = mSounds[ident]
336 if dat then
337 return dat.CurrentSound
338 end
339 end
340end)
341
342
343----------------------------------------------
344-- DebounceProvider class -- Prevent events
345-- from happening in too rapid succession
346----------------------------------------------
347class'DebounceProvider'(function(this)
348 local mFlagNameToLastTime = {}
349
350 function this:test(ident, delta)
351 local t = tick()
352 local lastTime = mFlagNameToLastTime[ident] or 0
353 if delta then
354 return (t-lastTime) > delta
355 else
356 return mFlagNameToLastTime[ident]
357 end
358 end
359 function this:set(ident, state)
360 if state then
361 mFlagNameToLastTime[ident] = state
362 elseif state == false then
363 mFlagNameToLastTime[ident] = false
364 else
365 mFlagNameToLastTime[ident] = tick()
366 end
367 end
368end)
369
370
371function TagHumanoid(humanoid)
372 if Tool.Player then
373 local tag = Create'ObjectValue'{
374 Name = "creator",
375 Value = Tool.Player,
376 Parent = humanoid,
377 }
378 Tool.Bin:add(function()
379 tag:Remove()
380 end, 'HumanoidTag')
381 end
382end
383function UntagHumanoid()
384 Tool.Bin:clean('HumanoidTag')
385end
386
387
388------- wait for any event in a set of events to fire ------
389function WaitForAny(tb)
390 local evt = tb
391 local conn = {}
392 local eventargs = nil
393 local waitProxy = Create'BoolValue'{}
394 for _, e in pairs(evt) do
395 local c = e:connect(function(...)
396 for _, c in pairs(conn) do
397 c:disconnect()
398 end
399 eventargs = {...}
400 waitProxy.Value = not waitProxy.Value
401 end)
402 conn[#conn+1] = c
403 end
404 --
405 waitProxy.Changed:wait()
406 --
407 return unpack(eventargs)
408end
409
410
411----------------------------------------------
412-- Tool singleton class
413--API:
414-- ...
415class'Tool'(nil, function(this)
416 --need this here for the animationprovider to use
417 this.HUGE_EQUIP_HACK = false
418
419 this.Bin = CreateBin()
420 this.AnimationProvider = CreateAnimationProvider()
421 this.DebounceProvider = CreateDebounceProvider()
422 this.SoundProvider = CreateSoundProvider()
423
424 --general values
425 this.Tool = script.Parent
426 this.Player = nil
427 this.Humanoid = nil
428 this.Character = nil
429
430 --============ several flags for the gear
431 --nothing
432
433 --some events
434 this.Equipped = CreateSignal()
435 this.Unequipped = CreateSignal()
436 this.OwnerChange = CreateSignal()
437
438 --mouse utility events
439 this.MouseClick = CreateSignal()
440 this.MouseDoubleClick = CreateSignal()
441 this.DoubleClickThreshold = 0.2
442
443 local mLastClickTime = 0
444
445 script.Parent.Equipped:connect(function(mouse)
446 --print("Internal Equipped: Time b: "..time())
447 --set up general values in the tool
448 this.Mouse = mouse
449 local curOwner = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
450 if curOwner ~= this.Player then
451 this.Player = curOwner
452 this.OwnerChange:fire(this.Player)
453 end
454 this.Character = this.Player.Character
455 this.Humanoid = this.Character.Humanoid
456 this.AnimationProvider:setHumanoid(this.Humanoid)
457
458 --set up the mouse events
459 mouse.Button1Down:connect(function()
460 local t = tick()
461 if (t-mLastClickTime) < this.DoubleClickThreshold then
462 --prvent multiple double-clicks in a row
463 mLastClickTime = 0
464 this.MouseDoubleClick:fire(mouse)
465 else
466 mLastClickTime = t
467 this.MouseClick:fire(mouse)
468 end
469 end)
470
471 --done setup, call the equipped function
472 if this.HUGE_EQUIP_HACK then
473 --the HUGE_EQUIP_HACK flags tells the tool that the equip is a synchronous
474 --call as a result of parenting an animation to the character, which happens
475 --when the tool is picked up from the workspace, but not during normal equips
476 --(Why does this happen???), if this is the case, the call should be rederrred
477 --one tick to ensure that all of the gear's loading can complete before it's
478 --equipped event is called.
479 --TODO: Blame John for this.
480 Delay(0, function()
481 this.Equipped:fire(mouse)
482 end)
483 else
484 --otherwise, proceed as normal
485 this.Equipped:fire(mouse)
486 end
487 end)
488
489 script.Parent.Unequipped:connect(function()
490 --before my teardown, fire the event
491 this.Unequipped:fire()
492
493 --delete all my garbage
494 this.Bin:cleanAll()
495 end)
496end)
497
498
499
500---------------------------------------------------------------------------------------------------
501---------------------------------------------------------------------------------------------------
502---------------------------------------------------------------------------------------------------
503-- --
504-- Specific Gear code starts Here --
505-- --
506---------------------------------------------------------------------------------------------------
507---------------------------------------------------------------------------------------------------
508---------------------------------------------------------------------------------------------------
509
510--register my stuff
511Tool.AnimationProvider:registerAnimation('equip', 'http://www.roblox.com/asset/?id=66702743')
512Tool.AnimationProvider:registerAnimation('slash', 'http://www.roblox.com/asset/?id=66702758')
513Tool.AnimationProvider:registerAnimation('critup', 'http://www.roblox.com/asset/?id=66703957')
514Tool.AnimationProvider:registerAnimation('critdown', 'http://www.roblox.com/asset/?id=66703954')
515Tool.SoundProvider:registerSound('slash', 'rbxasset://sounds\\swordslash.wav')
516Tool.SoundProvider:registerSound('equip', 'rbxasset://sounds\\unsheath.wav')
517Tool.SoundProvider:registerSound('down', 'rbxasset://sounds\\swordlunge.wav')
518Tool.SoundProvider:registerSound('hitground', 'rbxasset://sounds\\snap.wav')
519
520local DamageEnbled = false
521local DamageToDo = 20
522local SparkleParts = {}
523local SparkleAttach = {}
524
525Tool.Equipped:connect(function()
526 print("Equipped")
527 Tool.AnimationProvider:getAnimation('equip'):Play(0, 1, 3)
528 Tool.SoundProvider:getSound('equip'):Play()
529 local handleTouchedConn = Tool.Tool.Handle.Touched:connect(function(part)
530 local h = (part.Parent or game):FindFirstChild("Humanoid")
531 if DamageEnbled and h then
532 TagHumanoid(h)
533 h:TakeDamage(DamageToDo)
534 wait(1)
535 UntagHumanoid()
536 end
537 end)
538 Tool.Bin:add(function()
539 handleTouchedConn:disconnect()
540 end, 'disconnect_handle_ontouched')
541
542 local color = true
543 for i = -3, 3, 1.5 do
544 color = not color
545 local p = Create'Part'{
546 Name = 'EffectPart',
547 FormFactor = 'Custom',
548 Size = Vector3.new(0.1, 0.1, 0.1),
549 Parent = Tool.Tool.Handle,
550 Transparency = 1,
551 CanCollide = false,
552 Create'Fire'{
553 Name = 'Effect',
554 Enabled = false,
555 Color = (color and Color3.new(1, 0, 0) or Color3.new(1, 1, 1)),
556 Size = 2,
557 },
558 }
559 --[[SparkleParts[#SparkleParts+1] = p
560 local motor = Create'Motor6D'{
561 Name = 'EffectAttach',
562 Parent = Tool.Tool.Handle,
563 Part0 = Tool.Tool.Handle,
564 Part1 = p,
565 C1 = CFrame.new(i, 0, 0),
566 }
567 SparkleAttach[#SparkleAttach+1] = motor]]
568 end
569 Tool.Bin:add(function()
570 for _, effectPart in pairs(SparkleParts) do
571 effectPart.Parent = nil
572 end
573 for _, p in pairs(SparkleAttach) do
574 p.Parent = nil
575 end
576 SparkleParts = {}
577 SparkleAttach = {}
578 end, 'kill_particle_effect')
579end)
580
581Tool.Unequipped:connect(function()
582 Tool.AnimationProvider:getAnimation('equip'):Stop()
583end)
584
585--utility to enable / disable damage. Makes sure that enable-disable
586--pairs don't ever interfear with one and other.
587local damageEnabledLevel = 0
588local function EnableDamage(damage)
589 DamageEnbled = true
590 DamageToDo = damage
591 damageEnabledLevel = damageEnabledLevel + 1
592end
593local function DisableDamage()
594 damageEnabledLevel = damageEnabledLevel - 1
595 if damageEnabledLevel <= 0 then
596 DamageEnbled = false
597 end
598end
599
600
601--set particles enabled
602local function SetBladeEffectEnabled(state)
603 for _, effectPart in pairs(SparkleParts) do
604 effectPart.Effect.Enabled = state
605 end
606end
607
608local function frand(low, high)
609 return low + math.random()*(high-low)
610end
611
612--local blues = {23,107,102,11,45,135}
613local blues = {5, 24, 1009, 105, 1017}
614function allThatIce(pos, isTurbo)
615 local count = 5
616 if (isTurbo == true) then count = 10 end
617
618 for i=1,count do
619 local p = Instance.new("Part")
620 p.BrickColor = BrickColor.new(blues[math.random(#blues)])
621 p.formFactor = 2
622 p.Size = Vector3.new(1,.4,1)
623 p.Material = Enum.Material.Ice
624 p.TopSurface = 0
625 p.BottomSurface = 0
626
627 local a = math.random() * 6.28
628 local d = Vector3.new(math.cos(a), 0, math.sin(a)).unit
629 p.Velocity = d * 25
630 p.RotVelocity = d
631 p.Position = pos + Vector3.new(0, math.random() * 3, 0) + (d * 2)
632 p.Parent = game.Workspace
633
634 debris:AddItem(p, 4)
635 end
636
637end
638
639--make the hitting ground effect
640local PossibleSplashColors = {Color3.new(1, 0, 0), Color3.new(.5, 0, 0)}
641local function CreateSplashEffect(pos)
642 local splashParts = {}
643 for i = 1, 20 do
644 local part = Create'Part'{
645 FormFactor = 'Custom',
646 Name = 'SlashParticle',
647 Transparency = 1,
648 CanCollide = false,
649 Size = Vector3.new(0.5, 0.5, 0.5),
650 CFrame = CFrame.new(pos),
651 Create'Fire'{
652 Name = 'Effect',
653 Size = 2,
654 Color = PossibleSplashColors[math.random(1, #PossibleSplashColors)],
655 },
656 Create'BodyVelocity'{
657 Name = 'Fly',
658 P = 100000,
659 maxForce = Vector3.new(0, 0, 0),
660 velocity = Vector3.new(frand(-1, 1),
661 frand(0.5,1),
662 frand(-1, 1)).unit * frand(20, 80),
663 },
664 }
665 splashParts[#splashParts+1] = part
666 part.Parent = game.Workspace
667 part.Velocity = part.Fly.velocity
668 Delay(frand(0.5, 2), function()
669 part.Parent = nil
670 end)
671 end
672 Tool.Bin:add(function()
673 for _, p in pairs(splashParts) do
674 p.Parent = nil
675 end
676 end, 'remove_splash_effect')
677end
678
679--====== main action code
680
681Tool.MouseClick:connect(function()
682 if Tool.DebounceProvider:test('slash', 0.5) then
683 Tool.DebounceProvider:set('slash')
684 Tool.AnimationProvider:getAnimation('slash'):Play(0, 1, 4)
685 Tool.SoundProvider:getSound('slash'):Play()
686 EnableDamage(20)
687 wait(0.7)
688 DisableDamage()
689 end
690end)
691
692Tool.MouseDoubleClick:connect(function()
693 if not Tool.DebounceProvider:test('doubleclick') then
694 Tool.DebounceProvider:set('doubleclick', true)
695 --
696 Tool.AnimationProvider:getAnimation('slash'):Stop(0)
697 Tool.AnimationProvider:getAnimation('critup'):Play(0, 1, 8)
698 local torso = Tool.Character:FindFirstChild("Torso")
699 if torso then
700 --jump high
701 Tool.Humanoid.Jump = true
702 torso.Velocity = torso.Velocity + Vector3.new(0, 120, 0)-- + (torso.CFrame.lookVector * 150)
703 local bv = Instance.new("BodyAngularVelocity")
704 bv.P = 1250
705 local mmm = torso.CFrame.lookVector
706 bv.angularvelocity = Vector3.new(mmm.z, 0, -mmm.x) * 8 --Vector3.new(0,0,0)
707 bv.maxTorque = Vector3.new(400000,400000,400000)
708 bv.Parent = torso
709
710 --wait for the character to reach the top of their jump
711 while torso.Velocity.y > 0.1 do
712 wait()
713 end
714
715 bv:Remove()
716
717--[[
718 local pos = torso.Position
719
720 for i, v in pairs(Workspace:GetChildren()) do
721 local h = v:FindFirstChild("Humanoid")
722 if h and h ~= Tool.Character.Humanoid then
723 local t = v:FindFirstChild("Torso")
724 if t then
725 if (t.Position - pos).magnitude <= 15 then
726 h.Sit = true
727 h.Parent.Torso.Velocity = (CFrame.new(script.Parent.Handle.Position, h.Parent.Torso.Position).lookVector * 200) + Vector3.new(0, 100, 0)
728 h.Parent.Torso.RotVelocity = Vector3.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
729 end
730 end
731 end
732 end]]
733
734
735 --now, switch to the critdown anim / sound, activate the damage,
736 --and wait for the player to hit something on their way down.
737 --also, speed up their descent
738 EnableDamage(40)
739 Tool.AnimationProvider:getAnimation('critup'):Stop(0)
740 Tool.AnimationProvider:getAnimation('critdown'):Play(0, 1, 10)
741 Tool.SoundProvider:getSound('down'):Play()
742 torso.Velocity = torso.Velocity - Vector3.new(0, 10, 0)
743
744 SetBladeEffectEnabled(true) --show some particles on the way down
745
746 local rightLeg = Tool.Character:FindFirstChild('Right Leg')
747 local leftLeg = Tool.Character:FindFirstChild('Left Leg')
748 WaitForAny{rightLeg.Touched, leftLeg.Touched}
749
750 SetBladeEffectEnabled(false) --get rid of the particles, we've leanded
751
752 --play the hit gound sound
753 Tool.SoundProvider:getSound('hitground'):Play()
754
755 --generate a splash effect where the collision occurred
756 local handle = Tool.Tool:FindFirstChild('Handle')
757 if handle then
758 --CreateSplashEffect((handle.CFrame*CFrame.new(2.5, 0, 0)).p)
759 allThatIce((handle.CFrame*CFrame.new(2.5,0,0)).p, true)
760 end
761
762 --now, we touched down, so halt the player for a cooldown, and
763 --wait a bit for the cooldown to expire
764 Tool.Humanoid.WalkSpeed = 0
765 wait(0.175)
766
767 --unfreeze them and stop the anim, also, disable the damage
768 Tool.Humanoid.WalkSpeed = 16
769 Tool.AnimationProvider:getAnimation('critdown'):Stop()
770 DisableDamage()
771 else
772 --no torso? Something is wrong, stop the anim
773 Tool.AnimationProvider:getAnimation('critup'):Stop(0)
774 end
775 --
776 Tool.DebounceProvider:set('doubleclick', false)
777 end
778end)
779
780--print("Done Running swordscript <"..mDebugId..">")
781end))
782Script14.Name = "MotorizeRightGrip"
783Script14.Parent = LocalScript13
784table.insert(cors,sandbox(Script14,function()
785function Create(ty)
786 return function(data)
787 local obj = Instance.new(ty)
788 for k, v in pairs(data) do
789 if type(k) == 'number' then
790 v.Parent = obj
791 else
792 obj[k] = v
793 end
794 end
795 return obj
796 end
797end
798
799local Tool = script.Parent.Parent
800
801local armChildRemovedConn = nil
802local Motor6DGrip = nil
803local EquippedNum = 0
804
805Tool.Equipped:connect(function()
806 EquippedNum = EquippedNum + 1
807 local myEquip = EquippedNum
808 --some vars
809 local Player = game.Players:GetPlayerFromCharacter(Tool.Parent)
810 local Character = Player.Character
811
812 local rightarm = Character:FindFirstChild('Right Arm')
813 if rightarm and rightarm:FindFirstChild('RightGrip') then
814 local rightGrip = rightarm['RightGrip']
815 local handle = rightGrip.Part1
816
817 --kill my joint when the normal joint is removed
818 --this must be done here so that the joint is removed
819 --_right away_ after unequipping and the character doesn't
820 --glitch up.
821 local armChildRemovedConn = rightarm.ChildRemoved:connect(function(ch)
822 if ch == rightGrip then
823 Motor6DGrip:Remove()
824 Motor6DGrip = nil
825 --
826 if handle and Character:FindFirstChild('Torso') then
827 if Tool.Parent.Parent:IsA('Player') then
828 --the sword has been deselected
829 --put the sword far away so the user doesn't notice that the handle doesn't
830 --update for about 0.1 seconds after selecting the tool.
831 handle.CFrame = CFrame.new(100000, 100000, 100000)
832 else
833 --if in the workspace, position the handle where it should be dropped
834 --use the size of the handle to make sure it's dropped far enough away
835 handle.CFrame = Character.Torso.CFrame * CFrame.new(0, 0, -(handle.Size.magnitude+2))
836 end
837 end
838 end
839 end)
840
841 --make my new joint
842 Motor6DGrip = Create'Motor6D'{
843 Name = 'RightGrip_Motor',
844 Part0 = rightarm,
845 Part1 = handle,
846 }
847 --kill the old weld
848 rightGrip.Part1 = nil
849 rightGrip.Part0 = nil
850 Motor6DGrip.Parent = rightGrip.Parent
851 Motor6DGrip.C1 = Motor6DGrip.C1 * CFrame.Angles(0, -math.pi/2, 0)
852 Motor6DGrip.C1 = Motor6DGrip.C1 * CFrame.Angles(math.pi/2, 0, 0)
853 Motor6DGrip.C1 = Motor6DGrip.C1 + Vector3.new(0.20, 0, 0)
854 end
855end)
856
857Tool.Unequipped:connect(function()
858 EquippedNum = EquippedNum + 1
859 if armChildRemovedConn then
860 armChildRemovedConn:disconnect()
861 armChildRemovedConn = nil
862 end
863end)
864
865end))
866Animation15.Name = "ANIM_equip"
867Animation15.Parent = Tool0
868Animation15.AnimationId = "rbxassetid://4047725350"
869Animation16.Name = "ANIM_slash"
870Animation16.Parent = Tool0
871Animation16.AnimationId = "rbxassetid://4059144400"
872Animation17.Name = "ANIM_critup"
873Animation17.Parent = Tool0
874Animation17.AnimationId = "rbxassetid://4047725350"
875Animation18.Name = "ANIM_critdown"
876Animation18.Parent = Tool0
877Animation18.AnimationId = "rbxassetid://4047725350"
878LocalScript19.Name = "SpinScr"
879LocalScript19.Parent = Tool0
880table.insert(cors,sandbox(LocalScript19,function()
881on = 0
882Tool = script.Parent
883torso = nil
884human = nil
885
886bv = Instance.new("BodyAngularVelocity")
887bv.P = 1250
888bv.angularvelocity = Vector3.new(0,26,0)
889bv.maxTorque = Vector3.new(0,400000,0)
890
891function Crouch(ison)
892 if torso == nil then
893 torso = Tool.Parent:FindFirstChild("Torso")
894 end
895 if human == nil then
896 human = Tool.Parent:FindFirstChild("Humanoid")
897 end
898
899 if ison == 0 then
900 while torso:FindFirstChild("BodyAngularVelocity") do
901 torso:FindFirstChild("BodyAngularVelocity"):Remove()
902 end
903 human.WalkSpeed = 16
904 elseif ison == 1 then
905 newf = bv:Clone()
906 newf.Parent = torso
907 newf.archivable = false
908 human.WalkSpeed = 32
909 end
910end
911
912function Key(key)
913 if key then
914 key = string.lower(key)
915 if (key=="x") then --SPIN TIME!
916 print("X key pressed")
917 if on == 1 then
918 on = 0
919 elseif on == 0 then
920 on = 1
921 end
922 Crouch(on)
923 end
924 end
925end
926
927function Equip(mouse)
928mouse.KeyDown:connect(Key)
929end
930function Unequip()
931print("Unequipping!")
932 while torso:FindFirstChild("BodyAngularVelocity") do
933 torso:FindFirstChild("BodyAngularVelocity"):Remove()
934 end
935 human.WalkSpeed = 16
936end
937script.Parent.Equipped:connect(Equip)
938script.Parent.Unequipped:connect(Unequip)
939end))
940Script20.Parent = Tool0
941table.insert(cors,sandbox(Script20,function()
942print ("VIP Shirt Door Script Loaded")
943
944-- list of account names allowed to go through the door.
945permission = { "robloxowns1" , "cooldog0204" , "http://www.roblox.com/Fight-On-A-Nintendo-3DS-VIP-item?id=94383317" } -- This is how many people can still get through, so u don't have to change shirts. You can also have another friend here.
946
947-- TextureId of the VIP shirt.
948texture = "http://www.roblox.com/Fight-On-A-Nintendo-3DS-VIP-item?id=94383317" -- Go to the wiki below this script to find out how to change the shirt. And paste the link in between the "" marks.
949
950function checkOkToLetIn(name)
951 for i = 1,#permission do
952 -- convert strings to all upper case, otherwise we will let in
953 -- "Username" but not "username" or "uSERNAME"
954 if (string.upper(name) == string.upper(permission[i])) then return true end
955 end
956 return false
957end
958
959local Door = script.Parent
960
961function onTouched(hit)
962 print("Door Hit")
963 local human = hit.Parent:findFirstChild("Humanoid")
964 if (human ~= nil ) then
965 if human.Parent.Torso.roblox.Texture == texture then --the shirt
966 Door.Transparency = 0.7
967 Door.CanCollide = false
968 wait(4) -- this is how long the door is open
969 Door.CanCollide = true
970 Door.Transparency = 0
971 -- a human has touched this door!
972 print("Human touched door")
973 -- test the human's name against the permission list
974 elseif (checkOkToLetIn(human.Parent.Name)) then
975 print("Human passed test")
976 Door.Transparency = 0.7
977 Door.CanCollide = false
978 wait(4) -- this is how long the door is open
979 Door.CanCollide = true
980 Door.Transparency = 0
981 else human.Health = 0 -- delete this line of you want a non-killing VIP door
982 end
983 end
984end
985
986script.Parent.Touched:connect(onTouched)
987
988
989
990end))
991for i,v in pairs(mas:GetChildren()) do
992 v.Parent = game:GetService("Players").LocalPlayer.Backpack
993 pcall(function() v:MakeJoints() end)
994end
995mas:Destroy()
996for i,v in pairs(cors) do
997 spawn(function()
998 pcall(v)
999 end)
1000end