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