Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,game,owner = owner,game
- local RealPlayer = Player
- do
- print("FE Compatibility code by Mokiros")
- local rp = RealPlayer
- script.Parent = rp.Character
- --RemoteEvent for communicating
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- --Fake event to make stuff like Mouse.KeyDown work
- local function fakeEvent()
- local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
- t.connect = t.Connect
- return t
- end
- --Creating fake input objects with fake variables
- local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
- local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
- CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
- end}
- --Merged 2 functions into one by checking amount of arguments
- CAS.UnbindAction = CAS.BindAction
- --This function will trigger the events that have been :Connect()'ed
- local function te(self,ev,...)
- local t = m[ev]
- if t and t._fakeEvent then
- for _,f in pairs(t.Functions) do
- f(...)
- end
- end
- end
- m.TrigEvent = te
- UIS.TrigEvent = te
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=rp then return end
- m.Target = io.Target
- m.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return m:TrigEvent(b and "Button1Down" or "Button1Up")
- end
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return m:TrigEvent(b and "Button2Down" or "Button2Up")
- end
- for _,t in pairs(CAS.Actions) do
- for _,k in pairs(t.Keys) do
- if k==io.KeyCode then
- t.Function(t.Name,io.UserInputState,io)
- end
- end
- end
- m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[
- local Player = game:GetService("Players").LocalPlayer
- local Event = script:WaitForChild("UserInput_Event")
- local Mouse = Player:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,a)
- if a then return end
- --Since InputObject is a client-side instance, we create and pass table instead
- Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local h,t
- --Give the server mouse data 30 times every second, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- while wait(1/30) do
- if h~=Mouse.Hit or t~=Mouse.Target then
- h,t=Mouse.Hit,Mouse.Target
- Event:FireServer({isMouse=true,Target=t,Hit=h})
- end
- end]==],Player.Character)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local _rg = game
- --Metatable for fake service
- local fsmt = {
- __index = function(self,k)
- local s = rawget(self,"_RealService")
- if s then
- return typeof(s[k])=="function"
- and function(_,...)return s[k](s,...)end or s[k]
- end
- end,
- __newindex = function(self,k,v)
- local s = rawget(self,"_RealService")
- if s then s[k]=v end
- end
- }
- local function FakeService(t,RealService)
- t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
- return setmetatable(t,fsmt)
- end
- --Fake game object
- local g = {
- GetService = function(self,s)
- return rawget(self,s) or _rg:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- RenderStepped = _rg:GetService("RunService").Heartbeat,
- BindToRenderStep = function(self,name,_,fun)
- self._btrs[name] = self.Heartbeat:Connect(fun)
- end,
- UnbindFromRenderStep = function(self,name)
- self._btrs[name]:Disconnect()
- end,
- },"RunService")
- }
- rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
- g.service = g.GetService
- FakeService(g,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = g,g.Players.LocalPlayer
- end
- Player = game:GetService("Players").LocalPlayer
- Character = Player.Character
- PlayerGui = Player.PlayerGui
- Backpack = Player.Backpack
- Torso = Character.Torso
- Head = Character.Head
- Humanoid = Character.Humanoid
- LeftArm = Character["Left Arm"]
- LeftLeg = Character["Left Leg"]
- RightArm = Character["Right Arm"]
- RightLeg = Character["Right Leg"]
- LS = Torso["Left Shoulder"]
- LH = Torso["Left Hip"]
- RS = Torso["Right Shoulder"]
- RH = Torso["Right Hip"]
- Neck = Torso.Neck
- it=Instance.new
- vt=Vector3.new
- cf=CFrame.new
- euler=CFrame.fromEulerAnglesXYZ
- angles=CFrame.Angles
- function swait(num)
- if num==0 or num==nil then
- game:service'RunService'.RenderStepped:wait()
- else
- for i=0,num do
- game:service'RunService'.RenderStepped:wait()
- end
- end
- end
- if Character:findFirstChild("SwordBall",true) ~= nil then
- Character:findFirstChild("SwordBall",true).Parent = nil
- end
- function part(formfactor,parent,reflectance,transparency,brickcolor,name,size)
- local fp = it("Part")
- fp.formFactor = formfactor
- fp.Parent = parent
- fp.Reflectance = reflectance
- fp.Transparency = transparency
- fp.CanCollide = false
- fp.Locked=true
- fp.BrickColor = brickcolor
- fp.Name = name
- fp.Size = size
- fp.Position = Torso.Position
- fp.BottomSurface="Smooth"
- fp.TopSurface="Smooth"
- fp:BreakJoints()
- return fp
- end
- function mesh(Mesh,part,meshtype,meshid,offset,scale)
- local mesh = it(Mesh)
- mesh.Parent = part
- if Mesh=="SpecialMesh" then
- mesh.MeshType = meshtype
- mesh.MeshId = meshid
- end
- mesh.Offset=offset
- mesh.Scale=scale
- return mesh
- end
- function weld(parent,part0,part1,c0)
- local weld = it("Weld")
- weld.Parent = parent
- weld.Part0 = part0
- weld.Part1 = part1
- weld.C0 = c0
- return weld
- end
- showDamage=function(Char,Dealt,du,Color)
- m=Instance.new("Model")
- m.Name=tostring(Dealt)
- h=Instance.new("Humanoid")
- h.Health=0
- h.MaxHealth=0
- h.Parent=m
- c=Instance.new("Part")
- c.Transparency=0
- c.BrickColor=Color
- c.Name="Head"
- c.TopSurface=0
- c.BottomSurface=0
- c.formFactor="Plate"
- c.Size=Vector3.new(1,.4,1)
- ms=Instance.new("CylinderMesh")
- ms.Scale=Vector3.new(.8,.8,.8)
- if CRIT==true then
- ms.Scale=Vector3.new(1,1.25,1)
- end
- ms.Parent=c
- c.Reflectance=0
- Instance.new("BodyGyro").Parent=c
- c.Parent=m
- c.CFrame=CFrame.new(Char["Head"].CFrame.p+Vector3.new(0,1.5,0))
- f=Instance.new("BodyPosition")
- f.P=2000
- f.D=100
- f.maxForce=Vector3.new(math.huge,math.huge,math.huge)
- f.position=c.Position+Vector3.new(0,3,0)
- f.Parent=c
- game:GetService("Debris"):AddItem(m,.5+du)
- c.CanCollide=false
- m.Parent=workspace
- c.CanCollide=false
- end
- local swordball=Instance.new("Model")
- swordball.Parent=Character
- swordball.Name="SwordBall"
- local proppart=part(1,swordball,0,1,BrickColor.new("Black"),"Derp",vt(1,1,1))
- local sou=Instance.new("Sound")
- sou.Parent=proppart
- sou.Volume=1
- sou.Pitch=1
- sou.SoundId="http://www.roblox.com/asset/?id=168589016"
- sou.Looped=true
- --sou:play()
- local propwld=weld(proppart,proppart,Torso,euler(0,0,0)*cf(0,-9,0))
- local prt1=part(3,swordball,0,1,BrickColor:Random(),"BallRef",vt(2,2,2))
- local prt2=part(3,swordball,0,0,BrickColor:Random(),"Ball",vt(1,1,1))
- local msh2=mesh("SpecialMesh",prt2,"Sphere","",vt(0,0,0),vt(3,3,3))
- local wld2=weld(prt2,prt2,prt1,cf(0,0,0)*euler(0,0,0))
- coroutine.resume(coroutine.create(function(Weld,Part)
- derp=0
- while Part.Parent~=nil do
- swait()
- wld2.C0=euler(0,derp,0)
- derp=derp+0.1
- end
- end),wld2,prt2)
- numb=0
- numb2=0
- for i=1,8 do
- for i=1,8 do
- local prt3=part(3,swordball,0,0,BrickColor:Random(),"Sword",vt(1,1,1))
- local msh3=mesh("SpecialMesh",prt3,"FileMesh","http://www.roblox.com/asset/?id=1029523",vt(0,0,0),vt(0.05,0.05,0.05))
- --http://www.roblox.com/asset/?id=1029523
- local wld3=weld(prt3,prt3,prt2,cf(0,0,2.5)*euler(numb,numb2,numb2))
- numb=numb+0.785
- end
- numb2=numb2+0.785
- end
- prop=Instance.new("RocketPropulsion")
- prop.MaxSpeed=5000
- prop.CartoonFactor=0
- prop.MaxThrust=100000
- prop.Parent=prt2
- prop.Target=proppart
- prop.ThrustD=1.5
- prop.TurnD=0
- prop.TurnP=0
- prop:Fire()
- --[[velp=Instance.new("BodyGyro")
- velp.Parent=prt1
- velp.maxTorque=Vector3.new(4e+005,4e+005,4e+005)*math.huge
- velp.P=20e+003
- velp.cframe=cf(0,0,0)
- coroutine.resume(coroutine.create(function(Velo,Part)
- while Part.Parent~=nil do
- for i=0,1,0.1 do
- swait()
- Velo.cframe=Velo.cframe*euler(0,3.14*i,0)
- end
- end
- end),velp,sprt)]]
- --[[wait(5)
- local sou=Instance.new("Sound")
- sou.Parent=prt1
- sou.Volume=1
- sou.Pitch=1
- sou.SoundId="rbxasset://sounds\\unsheath.wav"
- sou.Looped=true
- wait()
- sou:play() ]]
- while true do
- swait(200)
- for d=1,1 do
- for _,c in pairs(workspace:children()) do
- local hum=c:findFirstChild("Humanoid")
- if hum~=nil then
- local head=c:findFirstChild("Torso")
- if head~=nil then
- local targ=head.Position-prt1.Position
- local mag=targ.magnitude
- if mag<=10000 and c.Name~=Player.Name then
- local sprt=part(3,workspace,0,1,BrickColor:Random(),"Sword",vt(6,6,6))
- local sprt2=part(3,workspace,0,0,BrickColor:Random(),"Sword",vt(1,1,1))
- local smsh=mesh("SpecialMesh",sprt2,"FileMesh","http://www.roblox.com/asset/?id=1029523",vt(0,0,0),vt(0.1,0.1,0.1))
- local swld=weld(sprt2,sprt2,sprt,euler(0,0,0))
- local teh=0
- game:GetService("Debris"):AddItem(sprt,20)
- game:GetService("Debris"):AddItem(sprt2,20)
- coroutine.resume(coroutine.create(function(Weld,Part)
- numb1=0
- while Part.Parent~=nil do
- swait()
- Part.BrickColor=BrickColor:Random()
- Weld.C0=Weld.C0*angles(0,numb1,0)
- numb1=math.pi/math.random(10,20)
- end
- end),swld,sprt2)
- sprt.CFrame=prt1.CFrame
- sprt.Velocity=vt(-math.random(20,50),math.random(20,50),-math.random(20,50))
- --[[if d==1 then
- sprt.Velocity=vt(math.random(50,200),math.random(20,50),0)
- elseif d==2 then
- sprt.Velocity=vt(-math.random(50,200),math.random(20,50),0)
- elseif d==3 then
- sprt.Velocity=vt(0,math.random(20,50),math.random(50,200))
- elseif d==4 then
- sprt.Velocity=vt(0,math.random(20,50),-math.random(50,200))
- end]]
- local sou=Instance.new("Sound")
- sou.Parent=sprt
- sou.Volume=1
- sou.Pitch=1
- sou.SoundId="http://www.roblox.com/asset/?id=166545328"
- --sou.SoundId="http://www.roblox.com/asset/?id=168589016"
- sou.Looped=true
- sou:play()
- prop=Instance.new("RocketPropulsion")
- prop.MaxSpeed=50000
- prop.CartoonFactor=0
- prop.MaxThrust=100000
- prop.Parent=sprt
- prop.Target=head
- --[[prop.TurnD=0
- prop.TurnP=100]]
- prop:Fire()
- con1=sprt.Touched:connect(function(hit)
- if hit.Parent==nil then
- return
- end
- h=hit.Parent:FindFirstChild("Humanoid")
- for _,v in pairs(hit.Parent:children()) do
- if v:IsA("Humanoid") then
- h=v
- end
- end
- if h~=nil and hit.Parent.Name~=Character.Name and hit.Parent:FindFirstChild("Torso")~=nil then
- if h.Health~=0 then
- sprt.Parent=nil
- sprt2.Parent=nil
- damage=math.random(999999,99999999)
- h:TakeDamage(damage)
- hit:BreakJoints()
- hit.Anchored=false
- hit.Velocity=Vector3.new(math.random(-100,100),math.random(-100,100),math.random(-100,100))
- showDamage(h.Parent,damage,1,BrickColor.new("Bright red"))
- local sou=Instance.new("Sound")
- sou.Parent=hit
- sou.Volume=1
- sou.Pitch=1
- sou.SoundId="http://www.roblox.com/asset/?id=168009623"
- sou.Looped=false
- --sou:play()
- end
- elseif hit.Name~="Base" and hit.Parent~=swordball and hit.Parent.Name~=Character.Name and hit.Name~="Sword" then
- hit:BreakJoints()
- hit.Velocity=Vector3.new(math.random(-100,100),math.random(-100,100),math.random(-100,100))
- hit.Anchored=false
- end
- end)
- end
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement