Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --this uses really old code of mine
- --don't judge
- oc=oc or function(f) return f end
- --SETUP VARIABLES
- local plr=game.Players.LocalPlayer
- local char=plr.Character
- local mouse=plr:GetMouse()
- Instance.new("BlockMesh",char.HumanoidRootPart).Scale=Vector3.new(0,0,0)
- local mouseDown=false
- mouse.Button1Down:connect(oc(function()
- mouseDown=true
- end))
- mouse.Button1Up:connect(oc(function()
- mouseDown=false
- end))
- --START WELD/ANIMATION CODE
- local function getRelative(v1,v2)
- return v1*(v2-(v2.p*2)):inverse()*CFrame.new():inverse()
- end
- weld={
- prep=function(armstr)
- local n=armstr=="Left" and -1 or 1
- local arm=char[armstr.." Arm"]
- local torso=char.Torso
- local startcf=torso.CFrame
- torso.CFrame=CFrame.new()
- local shoulder=torso[armstr.." Shoulder"]
- local newp=Instance.new("Part",char)
- newp.FormFactor="Custom"
- newp.Size=Vector3.new(1,1,1)
- newp.Transparency=1
- newp.Name=armstr.."Part"
- Instance.new("BlockMesh",newp).Scale=Vector3.new(0,0,0)
- local weld=Instance.new("Weld",torso)
- weld.C0=CFrame.new(1.5*n,0.5,0)
- Instance.new("CFrameValue",weld).Value=CFrame.new(1.5*n,0.499,0)
- weld.Part0=torso
- weld.Part1=newp
- local weld2=Instance.new("Weld",arm)
- weld2.C0=CFrame.new(0,0.5,0)
- weld2.Part0=arm
- weld2.Part1=newp
- _G[armstr.."SH"]=shoulder
- _G[armstr.."W"]=weld
- torso.CFrame=startcf
- shoulder:remove()
- return weld
- end,
- rotate=function(arm,x,y,z)
- arm.C0=CFrame.new(arm.C0.p)*CFrame.Angles(x,y,z)
- end,
- position=function(arm,x,y,z)
- arm.C0=(arm.Value.Value+Vector3.new(x,y,z))*(arm.C0-arm.C0.p)
- end,
- rotateA=function(arm,x,y,z) --rotateAppend
- arm.C0=arm.C0*CFrame.Angles(x,y,z)
- end,
- positionA=function(arm,x,y,z) --positionAppend
- arm.C0=arm.C0+Vector3.new(x,y,z)
- end,
- remove=function(armstr)
- char[armstr.."Part"]:remove()
- local torso=char.Torso
- _G[armstr.."W"]:remove()
- _G[armstr.."SH"].Parent=torso
- end,
- gWeld=function(p0,p1,c0) --generalWeld
- p1.CFrame=getRelative(p0.CFrame,c0)
- local w=Instance.new("Weld",p0)
- w.Part0=p0
- w.Part1=p1
- w.C0=c0
- return w
- end
- }
- --START BLOCKY EFFECT THINGY CODE
- local blockFx={}
- do
- local function randAng()
- local deg=math.pi/180
- return CFrame.Angles(math.random(-deg*18000,deg*18000)/100,math.random(-deg*18000,deg*18000)/100,math.random(-deg*18000,deg*18000)/100)
- end
- function blockFx.create(num,size,prop)
- local realSize=Instance.new("Part")
- realSize.FormFactor="Custom"
- realSize.Size=Vector3.new(size,size,size)
- realSize.Name="Real"
- local vel=Instance.new("BodyForce",realSize)
- vel.force=Vector3.new(0,196.2*(size^3+(num-1)),0)
- for i,v in pairs(prop) do
- realSize[i]=(type(v)=="function" and func(v) or v)
- end
- local model=Instance.new("Model")
- realSize.Parent=model
- local mass=realSize:GetMass()
- for i=1,num-1 do
- local p=Instance.new("Part")
- p.CanCollide=false
- p.FormFactor="Custom"
- p.Size=Vector3.new(1,1,1)
- mass=mass+p:GetMass()
- p.Parent=model
- weld.gWeld(realSize,p,CFrame.new())
- Instance.new("BlockMesh",p).Scale=Vector3.new(size,size,size) -- Better performance.
- end
- print(mass,size^3+(num-1))
- local tab={}
- tab.onTouch=function() end
- tab.spinning=false
- function tab:startSpin()
- self.spinning=true
- coroutine.resume(self.spinCoroutine)
- end
- function tab:stopSpin()
- self.spinning=false
- end
- tab.spinCoroutine=coroutine.create(function()
- while wait() do
- if not tab.spinning then
- coroutine.yield()
- end
- tab:updateSpin()
- end
- end)
- function tab:children()
- return model:children()
- end
- function tab:updateSpin()
- --self.Real.CFrame=self.Real.CFrame*randAng()
- for i,v in pairs(self.Real:children()) do
- if v:IsA("Weld") then -- Never too safe.
- v.C1=v.C1*randAng()
- end
- end
- end
- function tab:reprop(k,v)
- for _,p in pairs(self:children()) do
- if p:IsA("BasePart") then
- p[k]=v
- end
- end
- end
- function tab:move(cf)
- self:reprop("CFrame",cf)
- self:updateSpin()
- end
- function tab:addVelocity(vector)
- local mass=size^3+(num-1)
- vel.force=vel.force+(vector*self:getMass())
- end
- function tab:remove()
- model:remove()
- end
- function tab:getMass()
- return size^3+(num-1)
- end
- model.Real.Touched:connect(oc(function(...)
- if tab.onTouch then
- oc(tab.onTouch(...))
- end
- end))
- return setmetatable(tab,{__index=model,__newindex=model})
- end
- end
- --GP FUNCTIONS
- function add(t,...)
- for _,v in pairs({...}) do
- game:service("Debris"):AddItem(v,t)
- end
- end
- local staffBody=Instance.new("Part")
- staffBody.Name="Staff"
- staffBody.FormFactor="Custom"
- staffBody.Size=Vector3.new(0.2,0.2,5)
- staffBody.Parent=char
- staffBody.CFrame=CFrame.new(0,15,0)
- staffBody.CanCollide=false
- weld.gWeld(char["Right Arm"],staffBody,CFrame.new(0,-1,1))
- Instance.new("BlockMesh",staffTip)
- local staffTip=Instance.new("Part")
- staffTip.Anchored=false
- staffTip.Name="StaffTip"
- staffTip.FormFactor="Custom"
- staffTip.Size=Vector3.new(0.4,0.4,0.4)
- staffTip.Parent=char
- staffTip.CFrame=CFrame.new(0,30,0)
- staffTip.CanCollide=false
- Instance.new("BlockMesh",staffTip)
- local tipWeld=weld.gWeld(staffBody,staffTip,CFrame.new(0,0,-3))
- local tipSparkles=Instance.new("Sparkles",staffTip)
- coroutine.resume(coroutine.create(function()
- while true do
- char.HumanoidRootPart.Transparency=1
- tipWeld.C0=tipWeld.C0*CFrame.Angles(0,0,math.pi*wait(1/60))
- tipSparkles.SparkleColor=BrickColor.random().Color
- if char:findFirstChild("RightPart") then
- --char["RightPart"].Transparency=1
- end
- end
- end))
- local armWeld
- local function shiftPos(v)
- if v==1 then
- armWeld=weld.prep("Right")
- weld.rotate(armWeld,0,0,0)
- for i=0,math.pi/2,math.pi/22.25 do
- weld.rotate(armWeld,i,0,0)
- wait(1/60)
- end
- weld.rotate(armWeld,math.pi/2,0,0)
- elseif v==0 then
- for i=0,math.pi/2,math.pi/22.25 do
- weld.rotate(armWeld,math.pi/2-i,0,0)
- wait(1/60)
- end
- weld.rotate(armWeld,0,0,0)
- weld.remove("Right")
- end
- end
- local function playSound(id)
- local s=Instance.new("Sound",workspace)
- s.SoundId="http://www.roblox.com/asset/?id="..id
- s.Volume=1
- s:Play()
- end
- local function remSparklesFromChar(cha)
- local function r(o)
- for i,v in pairs(o:children()) do
- if v:IsA("Sparkles") and v~=tipSparkles then
- v:Destroy()
- end
- r(v)
- end
- end
- r(cha)
- end
- local function sparkleTeleport(cha)
- for t=0,1,0.05 do
- for i,v in pairs(cha:children()) do
- if v:IsA("Hat") then
- for _i,_v in pairs(v:children()) do
- if _v:IsA("BasePart") then
- _v.Transparency=t
- Instance.new("Sparkles",_v).SparkleColor=BrickColor.random().Color
- end
- end
- elseif v:IsA("BasePart") and v~=staffBody and v~=staffTip then
- v.Transparency=t
- Instance.new("Sparkles",v).SparkleColor=BrickColor.random().Color
- elseif v:IsA("BasePart") and v~=cha.HumanoidRootPart then
- v.Transparency=t
- end
- end
- wait()
- end
- return function(point)
- cha.Torso.CFrame=CFrame.new(point)*(cha.Torso.CFrame-cha.Torso.CFrame.p)+Vector3.new(0,2,0)
- for t=0,1,0.05 do
- for i,v in pairs(cha:children()) do
- if v:IsA("Hat") then
- for _i,_v in pairs(v:children()) do
- if _v:IsA("BasePart") then
- _v.Transparency=0.95-t
- _v.Sparkles:remove()
- end
- end
- elseif v:IsA("BasePart") and v~=staffBody and v~=staffTip and v~=char.HumanoidRootPart then
- v.Transparency=0.95-t
- v.Sparkles:remove()
- elseif v:IsA("BasePart") and v~=cha.HumanoidRootPart then
- v.Transparency=0.95-t
- end
- end
- wait()
- end
- remSparklesFromChar(cha)
- end
- end
- local spelldata={z={}}
- local nondebouncedListeners={
- z=function()
- if spelldata.z.targetHuman and spelldata.z.targetHuman.Parent and spelldata.z.targetHuman.Parent:findFirstChild("Torso") then
- local targ=spelldata.z.targetHuman.Parent
- remSparklesFromChar(targ)
- local p1=char.Torso.CFrame.p
- local p2=targ.Torso.CFrame.p
- wait(.1)
- coroutine.resume(coroutine.create(function()
- local f=sparkleTeleport(char)
- char.Torso.CFrame=CFrame.new(p2)
- f(p2)
- end))
- coroutine.resume(coroutine.create(function()
- local f=sparkleTeleport(targ)
- targ.Torso.CFrame=CFrame.new(p1)
- f(p1)
- end))
- spelldata.z.targetHuman=nil
- elseif mouse.Target and mouse.Target.Parent:findFirstChild("Humanoid") and mouse.Target.Parent:findFirstChild("Torso") then
- spelldata.z.targetHuman=mouse.Target.Parent.Humanoid
- for i=1,15 do
- Instance.new("Sparkles",mouse.Target.Parent.Torso).SparkleColor=BrickColor.random().Color
- end
- mouse.Target.Parent.Humanoid.Died:connect(function()
- spelldata.z.targetHuman=nil
- end)
- end
- end
- }
- local spells={
- q=function()
- for i=1,5 do
- weld.rotateA(armWeld,math.pi/90,0,0)
- wait(1/60)
- end
- local cOff=CFrame.new(0,0,-0.8)
- local function getDesired()
- return getRelative(staffTip.CFrame,cOff)
- end
- local mod=blockFx.create(5,0.95,{})
- local mWeld=weld.gWeld(staffTip,mod.Real,cOff)
- mod.Parent=char
- mod:startSpin()
- mod:reprop("CanCollide",false)
- mod:reprop("Transparency",0.95)
- for i,v in pairs(mod:children()) do
- v.BrickColor=BrickColor.random()
- for _=1,10 do
- Instance.new("Sparkles",v).SparkleColor=BrickColor.random().Color
- end
- end
- mouse.Button1Down:wait()
- playSound(132890538)
- for i=1,5 do
- weld.rotateA(armWeld,math.pi/90,0,0)
- wait(1/60)
- end
- local done=false
- local force=(mouse.Hit.p-getDesired().p).unit*360
- mWeld:Destroy()
- mod:move(getDesired())
- mod:addVelocity(force)
- local function rem()
- local x=Instance.new("Explosion")
- x.BlastPressure=0
- x.BlastRadius=8
- x.Position=mod.Real.Position
- local hitHums={}
- x.Hit:connect(function(p,d)
- if p.Parent:findFirstChild("Humanoid") and not hitHums[p.Parent:findFirstChild("Humanoid")] then
- hitHums[p.Parent.Humanoid]=true
- p.Parent.Humanoid:TakeDamage(100-(d*20)>70 and 70 or (100-d*20<10 and 10 or 100-d*20))
- end
- end)
- x.Parent=workspace
- mod:remove()
- mod:stopSpin()
- end
- mod.onTouch=function(p)
- if p.Parent~=char and p.Parent.Parent~=char then
- rem()
- done=true
- end
- end
- coroutine.resume(coroutine.create(function()
- local timer=0
- repeat mod:reprop("Velocity",force) timer=timer+wait() until done or timer>4
- rem()
- end))
- wait(0.5)
- for i=1,10 do
- weld.rotateA(armWeld,-math.pi/90,0,0)
- wait(1/60)
- end
- end,
- e=function()
- local time=0.4
- local start=tick()
- coroutine.resume(coroutine.create(function() while true do
- local p=(tick()-start)/time
- p=math.min(1,p)
- staffTip.Mesh.Scale=Vector3.new(p*0.5+1,p*0.5+1,p*0.5+1)
- wait(1/60)
- if p==1 then
- break
- end
- end end))
- for i=1,5 do
- weld.rotateA(armWeld,math.pi/90,0,0)
- wait(1/60)
- end
- wait(.1)
- local done
- mouse.KeyDown:connect(function(k)
- if k=="e" then
- done=true
- end
- end)
- local drawPart=Instance.new("Part")
- drawPart.FormFactor="Custom"
- drawPart.Anchored=true
- drawPart.CanCollide=false
- local sparklePart=Instance.new("Part")
- sparklePart.Transparency=1
- sparklePart.Anchored=true
- sparklePart.CanCollide=false
- for i=1,10 do
- Instance.new("Sparkles",sparklePart).SparkleColor=BrickColor.random().Color
- end
- repeat
- wait(1/60)
- if mouseDown then
- local downPoint=mouse.Hit.p
- drawPart.Size=Vector3.new(0.2,0.2,(staffTip.Position-downPoint).magnitude)
- drawPart.CFrame=CFrame.new((staffTip.Position+downPoint)/2,downPoint)
- sparklePart.CFrame=CFrame.new(downPoint)
- local _sparklePart=sparklePart:clone()
- _sparklePart.CFrame=CFrame.new(downPoint)
- _sparklePart.Parent=char
- add(2,_sparklePart)
- drawPart.Parent=char
- if mouse.Target and mouse.Target.Parent:findFirstChild("Humanoid") then
- mouse.Target.Parent.Humanoid:TakeDamage(1.5)
- end
- else
- sparklePart.Parent=nil
- drawPart.Parent=nil
- end
- until done
- local start=tick()
- coroutine.resume(coroutine.create(function() while true do
- local p=(tick()-start)/time
- p=math.min(1,p)
- staffTip.Mesh.Scale=Vector3.new(1.5-p*0.5,1.5-p*0.5,1.5-p*0.5)
- wait(1/60)
- if p==1 then
- break
- end
- end end))
- for i=1,5 do
- weld.rotateA(armWeld,-math.pi/90,0,0)
- wait(1/60)
- end
- end,
- r=function()
- coroutine.resume(coroutine.create(function()
- for i=1,5 do
- weld.rotateA(armWeld,math.pi/90,0,0)
- wait(1/60)
- end
- end))
- local finish=sparkleTeleport(char)
- wait(.75)
- mouse.Button1Down:wait()
- finish(mouse.Hit.p)
- for i=1,5 do
- weld.rotateA(armWeld,-math.pi/90,0,0)
- wait(1/60)
- end
- end
- }
- mouse.KeyDown:connect(oc(function(k)
- if nondebouncedListeners[k] and out==1 then
- nondebouncedListeners[k]()
- elseif spells[k] and not db and out==1 then
- db=true
- spells[k]()
- db=false
- elseif k=="z" and not db then
- db=true
- shiftPos(out==1 and 0 or 1)
- out=out==1 and 0 or 1
- db=false
- end
- end))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement