Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --https://github.com/Mokiros/roblox-FE-compatibility
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,Mouse,mouse,UserInputService,ContextActionService = owner
- local RealPlayer = Player
- do print("FE Compatibility code by Mokiros")local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end
- if script == nil then return end
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Model0 = Instance.new("Model")
- Part1 = Instance.new("Part")
- Motor6D2 = Instance.new("Motor6D")
- Motor6D3 = Instance.new("Motor6D")
- Motor6D4 = Instance.new("Motor6D")
- Motor6D5 = Instance.new("Motor6D")
- Motor6D6 = Instance.new("Motor6D")
- Motor6D7 = Instance.new("Motor6D")
- Motor6D8 = Instance.new("Motor6D")
- Part9 = Instance.new("Part")
- Motor6D10 = Instance.new("Motor6D")
- Part11 = Instance.new("Part")
- Motor6D12 = Instance.new("Motor6D")
- Part13 = Instance.new("Part")
- Part14 = Instance.new("Part")
- Part15 = Instance.new("Part")
- Part16 = Instance.new("Part")
- Part17 = Instance.new("Part")
- Part18 = Instance.new("Part")
- WedgePart19 = Instance.new("WedgePart")
- Model0.Name = "cannon3"
- Model0.Parent = mas
- Part1.Name = "mid"
- Part1.Parent = Model0
- Part1.CFrame = CFrame.new(-13.025012, 6.51455927, 31.326931, -1, 0, 0, 0, 1, 0, 0, 0, -1)
- Part1.Orientation = Vector3.new(0, 180, 0)
- Part1.Position = Vector3.new(-13.025012, 6.51455927, 31.326931)
- Part1.Rotation = Vector3.new(-180, 0, -180)
- Part1.Color = Color3.new(0.180392, 0.647059, 0.180392)
- Part1.Size = Vector3.new(1.04464507, 0.803574085, 2.08928943)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.BrickColor = BrickColor.new("Sea green")
- Part1.CanCollide = false
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.brickColor = BrickColor.new("Sea green")
- Motor6D2.Parent = Part1
- Motor6D2.C1 = CFrame.new(7.62939453e-06, 0.522288322, 0.562496185, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D2.Part0 = Part1
- Motor6D2.Part1 = Part18
- Motor6D2.part1 = Part18
- Motor6D3.Parent = Part1
- Motor6D3.C1 = CFrame.new(3.81469727e-06, 0.763356209, 0.562496185, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D3.Part0 = Part1
- Motor6D3.Part1 = Part13
- Motor6D3.part1 = Part13
- Motor6D4.Parent = Part1
- Motor6D4.C1 = CFrame.new(0, 0.682994366, 0.482135773, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D4.Part0 = Part1
- Motor6D4.Part1 = Part14
- Motor6D4.part1 = Part14
- Motor6D5.Parent = Part1
- Motor6D5.C1 = CFrame.new(0, -0.683033466, 0.562507629, 1, 0, 0, 0, -1, 0, 0, 0, -1)
- Motor6D5.Part0 = Part1
- Motor6D5.Part1 = WedgePart19
- Motor6D5.part1 = WedgePart19
- Motor6D6.Parent = Part1
- Motor6D6.C1 = CFrame.new(0, -0.401806831, 0.241065979, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D6.Part0 = Part1
- Motor6D6.Part1 = Part17
- Motor6D6.part1 = Part17
- Motor6D7.Parent = Part1
- Motor6D7.C1 = CFrame.new(0, -0.401813507, 0.241065979, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D7.Part0 = Part1
- Motor6D7.Part1 = Part16
- Motor6D7.part1 = Part16
- Motor6D8.Parent = Part1
- Motor6D8.C1 = CFrame.new(0, -3.52859497e-05, -1.16518402, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D8.Part0 = Part1
- Motor6D8.Part1 = Part11
- Motor6D8.part1 = Part11
- Part9.Name = "barrelout"
- Part9.Parent = Model0
- Part9.CFrame = CFrame.new(-13.025012, 6.51459646, 29.7599716, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Part9.Orientation = Vector3.new(0, -90, 0)
- Part9.Position = Vector3.new(-13.025012, 6.51459646, 29.7599716)
- Part9.Rotation = Vector3.new(0, -90, 0)
- Part9.Color = Color3.new(0.180392, 0.647059, 0.180392)
- Part9.Size = Vector3.new(0.562501252, 0.803574085, 1.04464507)
- Part9.BottomSurface = Enum.SurfaceType.Smooth
- Part9.BrickColor = BrickColor.new("Sea green")
- Part9.CanCollide = false
- Part9.TopSurface = Enum.SurfaceType.Smooth
- Part9.brickColor = BrickColor.new("Sea green")
- Part9.Shape = Enum.PartType.Cylinder
- Motor6D10.Parent = Part9
- Motor6D10.C1 = CFrame.new(0.0602722168, -2.38418579e-05, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D10.Part0 = Part9
- Motor6D10.Part1 = Part15
- Motor6D10.part1 = Part15
- Part11.Name = "frontmid"
- Part11.Parent = Model0
- Part11.CFrame = CFrame.new(-13.025012, 6.51459455, 30.161747, -1, 0, 0, 0, 1, 0, 0, 0, -1)
- Part11.Orientation = Vector3.new(0, 180, 0)
- Part11.Position = Vector3.new(-13.025012, 6.51459455, 30.161747)
- Part11.Rotation = Vector3.new(-180, 0, -180)
- Part11.Color = Color3.new(0.121569, 0.443137, 0.121569)
- Part11.Size = Vector3.new(1.04464507, 0.803574085, 0.241071463)
- Part11.BottomSurface = Enum.SurfaceType.Smooth
- Part11.BrickColor = BrickColor.new("Forest green")
- Part11.CanCollide = false
- Part11.TopSurface = Enum.SurfaceType.Smooth
- Part11.brickColor = BrickColor.new("Forest green")
- Motor6D12.Parent = Part11
- Motor6D12.C1 = CFrame.new(0.40177536, -1.90734863e-06, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D12.Part0 = Part11
- Motor6D12.Part1 = Part9
- Motor6D12.part1 = Part9
- Part13.Name = "bottomy"
- Part13.Parent = Model0
- Part13.CFrame = CFrame.new(-13.0250082, 5.75120306, 31.8894272, -1, 0, 0, 0, 1, 0, 0, 0, -1)
- Part13.Orientation = Vector3.new(0, 180, 0)
- Part13.Position = Vector3.new(-13.0250082, 5.75120306, 31.8894272)
- Part13.Rotation = Vector3.new(-180, 0, -180)
- Part13.Color = Color3.new(0.647059, 0.568627, 0.121569)
- Part13.Size = Vector3.new(1.12500238, 0.0803573132, 0.803572655)
- Part13.BottomSurface = Enum.SurfaceType.Smooth
- Part13.BrickColor = BrickColor.new("Dark Curry")
- Part13.CanCollide = false
- Part13.TopSurface = Enum.SurfaceType.Smooth
- Part13.brickColor = BrickColor.new("Dark Curry")
- Part14.Name = "bottomp"
- Part14.Parent = Model0
- Part14.CFrame = CFrame.new(-13.025012, 5.8315649, 31.8090668, -1, 0, 0, 0, 1, 0, 0, 0, -1)
- Part14.Orientation = Vector3.new(0, 180, 0)
- Part14.Position = Vector3.new(-13.025012, 5.8315649, 31.8090668)
- Part14.Rotation = Vector3.new(-180, 0, -180)
- Part14.Color = Color3.new(0.180392, 0.647059, 0.180392)
- Part14.Size = Vector3.new(1.04464507, 0.562502086, 1.12500203)
- Part14.BottomSurface = Enum.SurfaceType.Smooth
- Part14.BrickColor = BrickColor.new("Sea green")
- Part14.CanCollide = false
- Part14.TopSurface = Enum.SurfaceType.Smooth
- Part14.brickColor = BrickColor.new("Sea green")
- Part15.Name = "barrelin"
- Part15.Parent = Model0
- Part15.CFrame = CFrame.new(-13.025012, 6.5146203, 29.6996994, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Part15.Orientation = Vector3.new(0, -90, 0)
- Part15.Position = Vector3.new(-13.025012, 6.5146203, 29.6996994)
- Part15.Rotation = Vector3.new(0, -90, 0)
- Part15.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part15.Size = Vector3.new(0.522322536, 0.562501192, 0.562501192)
- Part15.BottomSurface = Enum.SurfaceType.Smooth
- Part15.BrickColor = BrickColor.new("Black")
- Part15.CanCollide = false
- Part15.TopSurface = Enum.SurfaceType.Smooth
- Part15.brickColor = BrickColor.new("Black")
- Part15.Shape = Enum.PartType.Cylinder
- Part16.Name = "incirc"
- Part16.Parent = Model0
- Part16.CFrame = CFrame.new(-13.025012, 6.91637278, 31.567997, -1, 0, 0, 0, 1, 0, 0, 0, -1)
- Part16.Orientation = Vector3.new(0, 180, 0)
- Part16.Position = Vector3.new(-13.025012, 6.91637278, 31.567997)
- Part16.Rotation = Vector3.new(-180, 0, -180)
- Part16.Color = Color3.new(0.647059, 0.568627, 0.121569)
- Part16.Size = Vector3.new(1.12500238, 1.28571701, 1.12500238)
- Part16.BottomSurface = Enum.SurfaceType.Smooth
- Part16.BrickColor = BrickColor.new("Dark Curry")
- Part16.CanCollide = false
- Part16.TopSurface = Enum.SurfaceType.Smooth
- Part16.brickColor = BrickColor.new("Dark Curry")
- Part16.Shape = Enum.PartType.Cylinder
- Part17.Name = "outcirc"
- Part17.Parent = Model0
- Part17.CFrame = CFrame.new(-13.025012, 6.9163661, 31.567997, -1, 0, 0, 0, 1, 0, 0, 0, -1)
- Part17.Orientation = Vector3.new(0, 180, 0)
- Part17.Position = Vector3.new(-13.025012, 6.9163661, 31.567997)
- Part17.Rotation = Vector3.new(-180, 0, -180)
- Part17.Color = Color3.new(0.180392, 0.647059, 0.180392)
- Part17.Size = Vector3.new(1.04464507, 1.76786184, 1.60714626)
- Part17.BottomSurface = Enum.SurfaceType.Smooth
- Part17.BrickColor = BrickColor.new("Sea green")
- Part17.CanCollide = false
- Part17.TopSurface = Enum.SurfaceType.Smooth
- Part17.brickColor = BrickColor.new("Sea green")
- Part17.Shape = Enum.PartType.Cylinder
- Part18.Name = "topy"
- Part18.Parent = Model0
- Part18.CFrame = CFrame.new(-13.0250044, 5.99227095, 31.8894272, -1, 0, 0, 0, 1, 0, 0, 0, -1)
- Part18.Orientation = Vector3.new(0, 180, 0)
- Part18.Position = Vector3.new(-13.0250044, 5.99227095, 31.8894272)
- Part18.Rotation = Vector3.new(-180, 0, -180)
- Part18.Color = Color3.new(0.647059, 0.568627, 0.121569)
- Part18.Size = Vector3.new(1.12500238, 0.0803573132, 0.803572655)
- Part18.BottomSurface = Enum.SurfaceType.Smooth
- Part18.BrickColor = BrickColor.new("Dark Curry")
- Part18.CanCollide = false
- Part18.TopSurface = Enum.SurfaceType.Smooth
- Part18.brickColor = BrickColor.new("Dark Curry")
- WedgePart19.Name = "bottomw"
- WedgePart19.Parent = Model0
- WedgePart19.CFrame = CFrame.new(-13.025012, 5.8315258, 30.7644234, -1, 0, 0, 0, -1, 0, 0, 0, 1)
- WedgePart19.Orientation = Vector3.new(0, 0, 180)
- WedgePart19.Position = Vector3.new(-13.025012, 5.8315258, 30.7644234)
- WedgePart19.Rotation = Vector3.new(0, 0, -180)
- WedgePart19.Color = Color3.new(0.180392, 0.647059, 0.180392)
- WedgePart19.Size = Vector3.new(1.04464507, 0.562501132, 0.964287579)
- WedgePart19.BottomSurface = Enum.SurfaceType.Smooth
- WedgePart19.BrickColor = BrickColor.new("Sea green")
- WedgePart19.CanCollide = false
- WedgePart19.brickColor = BrickColor.new("Sea green")
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Character
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas3 = Instance.new("Model",game:GetService("Lighting"))
- BillboardGui0 = Instance.new("BillboardGui")
- Frame1 = Instance.new("Frame")
- TextLabel2 = Instance.new("TextLabel")
- BillboardGui0.Parent = mas3
- BillboardGui0.Name = "damagegui"
- BillboardGui0.LightInfluence = 1
- BillboardGui0.Size = UDim2.new(0, 200, 0, 50)
- BillboardGui0.ClipsDescendants = true
- BillboardGui0.MaxDistance = 200
- BillboardGui0.StudsOffset = Vector3.new(0, 3.5, 0)
- Frame1.Parent = BillboardGui0
- Frame1.Size = UDim2.new(1, 0, 1, 0)
- Frame1.BackgroundColor = BrickColor.new("Institutional white")
- Frame1.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame1.BackgroundTransparency = 1
- TextLabel2.Parent = Frame1
- TextLabel2.Size = UDim2.new(1, 0, 1, 0)
- TextLabel2.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel2.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel2.BackgroundTransparency = 1
- TextLabel2.Font = Enum.Font.SourceSans
- TextLabel2.FontSize = Enum.FontSize.Size14
- TextLabel2.TextColor = BrickColor.new("Really black")
- TextLabel2.TextColor3 = Color3.new(0, 0, 0)
- TextLabel2.TextScaled = true
- TextLabel2.TextSize = 14
- TextLabel2.TextWrap = true
- TextLabel2.TextWrapped = true
- for i,v in pairs(mas3:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Character
- pcall(function() v:MakeJoints() end)
- end
- mas3:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas4 = Instance.new("Model",game:GetService("Lighting"))
- Model0 = Instance.new("Model")
- Part1 = Instance.new("Part")
- Weld2 = Instance.new("Weld")
- Part3 = Instance.new("Part")
- Model0.Name = "cannonshot"
- Model0.Parent = mas4
- Part1.Name = "mid"
- Part1.Parent = Model0
- Part1.CFrame = CFrame.new(-20.8750114, 4.79765224, 13.8997059, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Part1.Orientation = Vector3.new(0, -90, 0)
- Part1.Position = Vector3.new(-20.8750114, 4.79765224, 13.8997059)
- Part1.Rotation = Vector3.new(0, -90, 0)
- Part1.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part1.Size = Vector3.new(0.522322536, 0.562501192, 0.562501192)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.BrickColor = BrickColor.new("Black")
- Part1.CanCollide = false
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.brickColor = BrickColor.new("Black")
- Part1.Shape = Enum.PartType.Cylinder
- Weld2.Name = "barrelin"
- Weld2.Parent = Part1
- Weld2.C1 = CFrame.new(-0.272199988, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Weld2.Part0 = Part1
- Weld2.Part1 = Part3
- Weld2.part1 = Part3
- Part3.Name = "barrelin"
- Part3.Parent = Model0
- Part3.CFrame = CFrame.new(-20.8750114, 4.79765224, 14.1719055, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Part3.Orientation = Vector3.new(0, -90, 0)
- Part3.Position = Vector3.new(-20.8750114, 4.79765224, 14.1719055)
- Part3.Rotation = Vector3.new(0, -90, 0)
- Part3.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part3.Size = Vector3.new(0.522322536, 0.522322536, 0.522322536)
- Part3.BottomSurface = Enum.SurfaceType.Smooth
- Part3.BrickColor = BrickColor.new("Black")
- Part3.CanCollide = false
- Part3.TopSurface = Enum.SurfaceType.Smooth
- Part3.brickColor = BrickColor.new("Black")
- Part3.Shape = Enum.PartType.Ball
- for i,v in pairs(mas4:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Character
- pcall(function() v:MakeJoints() end)
- end
- mas4:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
- --// Services & modules
- local run = game:GetService("RunService")
- local tweens = game:GetService("TweenService")
- local iservice = game:GetService("UserInputService")
- local contentp = game:GetService("ContentProvider")
- local debris = game:GetService("Debris")
- local chats = game:GetService("Chat")
- --// Player
- local plr = game.Players.LocalPlayer
- local char = workspace:WaitForChild(plr.Name)
- local hum = char:WaitForChild("Humanoid")
- local root = char:WaitForChild("HumanoidRootPart")
- local torso = char:WaitForChild("Torso")
- local cannon = char:WaitForChild("cannon3")
- local mid = cannon:WaitForChild("mid")
- local cannonshot = char:WaitForChild("cannonshot"):Clone()
- script.Parent = char
- --// Loading
- local sounds = Instance.new("Folder", char.Head)
- sounds.Name = "sounds"
- local firesound = Instance.new("Sound")
- firesound.Name = "firesound"
- firesound.SoundId = "https://www.roblox.com/asset/?id=260433450"
- firesound.Parent = sounds
- local battlemusic = Instance.new("Sound")
- battlemusic.Name = "battlemusic"
- battlemusic.SoundId = "https://www.roblox.com/asset/?id=145047869"
- battlemusic.Looped = true
- battlemusic.Parent = sounds
- contentp:PreloadAsync(sounds:GetDescendants())
- battlemusic.Parent = char:WaitForChild("Head")
- firesound.Parent = char:WaitForChild("Head")
- battlemusic:Play()
- chats:Chat(char.Head,"Battle routine, set! Execute!",'Blue')
- --/ other
- CF = CFrame.new
- --// Joints
- local cannonjoint = Instance.new("Motor6D")
- cannonjoint.Name = "cannonjoint"
- cannonjoint.Part0 = char:WaitForChild("Right Arm")
- cannonjoint.Part1 = cannon.mid
- cannonjoint.C0 = CFrame.new(0,0,0) * CFrame.Angles(math.rad(-0),math.rad(0),math.rad(-0))
- cannonjoint.C1 = CFrame.new(0,2.3841857910156e-07,-0.493) * CFrame.Angles(math.rad(90),math.rad(0),math.rad(-180))
- cannonjoint.Parent = root
- local rooth = root:WaitForChild("RootJoint")
- local Neck = torso:WaitForChild("Neck")
- local LS = torso:WaitForChild("Left Shoulder")
- local RS = torso:WaitForChild("Right Shoulder")
- local LH = torso:WaitForChild("Left Hip")
- local RH = torso:WaitForChild("Right Hip")
- local animate = char:WaitForChild('Animate')
- local animator = hum:WaitForChild('Animator')
- print(rooth.C0)
- plrparts = {
- root = char:WaitForChild("HumanoidRootPart"),
- torso = char:WaitForChild("Torso"),
- LA = char:WaitForChild("Left Arm"),
- RA = char:WaitForChild("Right Arm"),
- LL = char:WaitForChild("Left Leg"),
- RL = char:WaitForChild("Right Leg")
- }
- local df = { -- this is the default cframe that all animations are lerped from.
- rooth.C0,
- rooth.C1,
- Neck.C0,
- Neck.C1,
- LS.C0,
- LS.C1,
- RS.C0,
- RS.C1,
- LH.C0,
- LH.C1,
- RH.C0,
- RH.C1
- }
- --// animation tables
- --[[
- helpful animation notes:
- somenaim = { -- animation name. could be anything
- [1] = { -- frame number
- rootC0,
- rootC1,
- neckC0,
- neckC1,
- lshoulderC0,
- lshoulderC1,
- rshoulderC0,
- rshoulderC1,
- lhipC0,
- lhipC1,
- rhipC0,
- rhipC1
- }
- }
- --]]
- -- Keyframe cframes are arranged in the following order:
- --[[
- AnimationName = {
- [KeyframeNumber] = {
- rootc0,
- rootc1,
- neckc0,
- neckc1,
- lshoulderc0,
- lshoulderc1,
- rshoulderc0,
- rshoulderc1,
- lhipc0,
- lhipc1,
- rhipc0,
- rhipc1
- }
- }
- ]]
- CannonShoot = {
- [1] = { -- this is the frame where the cannon points forward before launching back
- CF(0,0,0) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(-180)),
- CF(0,0,0) * CFrame.Angles(math.rad(-75.8),math.rad(-5.07),math.rad(160.6)),
- CF(0,1,0) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(-180)),
- CF(-5.5879354476929e-09,-0.49999997019768,0) * CFrame.Angles(math.rad(-105),math.rad(6.403302346887e-07),math.rad(-160)),
- CF(-1,0.5,0) * CFrame.Angles(math.rad(-0),math.rad(-90),math.rad(0)),
- CF(0.50000023841858,1.2969554662704,-0.069724768400192) * CFrame.Angles(math.rad(-95),math.rad(-30),math.rad(5)),
- CF(1,0.5,0) * CFrame.Angles(math.rad(-0),math.rad(90),math.rad(0)),
- CF(0.10000014305115,1.1000000238419,-4.7683715820313e-07) * CFrame.Angles(math.rad(76.5),math.rad(69.4),math.rad(180)),
- CF(-1,-1,0) * CFrame.Angles(math.rad(-0),math.rad(-90),math.rad(0)),
- CF(-0.38452365994453,1.0000004768372,-0.018738467246294) * CFrame.Angles(math.rad(180),math.rad(-85),math.rad(180)),
- CF(1,-1,0) * CFrame.Angles(math.rad(-0),math.rad(90),math.rad(0)),
- CF(0.65371870994568,0.98731589317322,0.17587691545486) * CFrame.Angles(math.rad(166.5),math.rad(69.4),math.rad(180)),
- },
- [2] = { -- cannon knocked backwards (note to ages, use the back easing style)
- CF(0,0,0) * CFrame.Angles(math.rad(-90.000002504478),math.rad(0),math.rad(-180.00000500896)),
- CF(0,0,0) * CFrame.Angles(math.rad(-100.17644478285),math.rad(6.7345456041782),math.rad(-153.85163663956)),
- CF(0,1,0) * CFrame.Angles(math.rad(-90.000002504478),math.rad(0),math.rad(-180.00000500896)),
- CF(0,-0.5,7.4505805969238e-09) * CFrame.Angles(math.rad(-83.205200544555),math.rad(-8.4141143074069),math.rad(151.24063290478)),
- CF(-1,0.5,0) * CFrame.Angles(math.rad(-0),math.rad(-90.000002504478),math.rad(0)),
- CF(0.49999997019768,0.95745557546616,-0.069725185632706) * CFrame.Angles(math.rad(-95.000001505251),math.rad(-30.000000834826),math.rad(4.9999972932255)),
- CF(1,0.5,0) * CFrame.Angles(math.rad(-0),math.rad(90.000002504478),math.rad(0)),
- CF(-0.45435512065887,0.66659039258957,0.22962585091591) * CFrame.Angles(math.rad(-109.59560349738),math.rad(62.814524551128),math.rad(28.400192946291)),
- CF(-1,-1,0) * CFrame.Angles(math.rad(-0),math.rad(-90.000002504478),math.rad(0)),
- CF(-0.38529708981514,0.92729723453522,-0.037512063980103) * CFrame.Angles(math.rad(157.47058505053),math.rad(-81.698843304244),math.rad(126.8433201329)),
- CF(1,-1,0) * CFrame.Angles(math.rad(-0),math.rad(90.000002504478),math.rad(0)),
- CF(0.24938356876373,1.1330413818359,0.2335514575243) * CFrame.Angles(math.rad(-35.317463613126),math.rad(65.174935475447),math.rad(26.407801152189)),
- }
- }
- --// useful functions
- local function inBack(t, b, c, d, s)
- if not s then s = 1.70158 end
- t = t / d
- return c * t * t * ((s + 1) * t - s) + b
- end
- local function outBack(t, b, c, d, s)
- if not s then s = 1.70158 end
- t = t / d - 1
- return c * (t * t * ((s + 1) * t + s) + 1) + b
- end
- local function inOutBack(t, b, c, d, s)
- if not s then s = 1.70158 end
- s = s * 1.525
- t = t / d * 2
- if t < 1 then
- return c / 2 * (t * t * ((s + 1) * t - s)) + b
- else
- t = t - 2
- return c / 2 * (t * t * ((s + 1) * t + s) + 2) + b
- end
- end
- local function outInBack(t, b, c, d, s)
- if t < d / 2 then
- return outBack(t * 2, b, c / 2, d, s)
- else
- return inBack((t * 2) - d, b + c / 2, c / 2, d, s)
- end
- end
- function fulltransparent(obj,v)
- local descendants = obj:GetDescendants()
- for index, descendant in pairs(descendants) do
- if descendant:IsA("BasePart") == true and descendant.Name ~= 'HumanoidRootPart' and descendant.Name:sub(-4) ~= "hbox" then
- descendant.Transparency = v
- end
- end
- end
- function fullcollision(obj,v)
- local descendants = obj:GetDescendants()
- for index, descendant in pairs(descendants) do
- if descendant:IsA("BasePart") == true then
- descendant.CanCollide = v
- end
- end
- end
- function fullremoval(obj,int)
- local descendants = obj:GetDescendants()
- for index, descendant in pairs(descendants) do
- if descendant:IsA("BasePart") == true then
- if int == nil then
- debris:AddItem(descendant)
- else
- debris:AddItem(descendant,int)
- end
- end
- end
- end
- ArtificialHB = Instance.new("BindableEvent", script)
- ArtificialHB.Name = "ArtificialHB"
- script:WaitForChild("ArtificialHB")
- framespeed = 1/60
- frame = framespeed
- tf = 0
- allowframeloss = false
- tossremainder = false
- lastframe = tick()
- script.ArtificialHB:Fire()
- game:GetService("RunService").Heartbeat:connect(function(s, p)
- tf = tf + s
- if tf >= frame then
- if allowframeloss then
- script.ArtificialHB:Fire()
- lastframe = tick()
- else
- for i = 1, math.floor(tf / frame) do
- script.ArtificialHB:Fire()
- end
- lastframe = tick()
- end
- if tossremainder then
- tf = 0
- else
- tf = tf - frame * math.floor(tf / frame)
- end
- end
- end)
- function swait(x) -- used for waiting a specified int of frames (as opposed to waiting for a float of seconds)
- if x == 0 or x == nil then
- ArtificialHB.Event:wait()
- else
- for i = 1, x do
- ArtificialHB.Event:wait()
- end
- end
- end
- --/ cframe garbage
- function mlerp(x,g,a) --not necessarily only for cframes, but really useful in them
- return x:lerp(g,a)
- end
- function convert(matrix)
- local PX,PY,PZ = matrix.X,matrix.Y,matrix.Z
- local AX,AY,AZ = matrix:toEulerAnglesXYZ()
- local function returnDeg(theta)
- return "math.rad("..math.deg(theta)..")"
- end
- local sep = ","
- local str1 = "CFrame.new("..PX..sep..PY..sep..PZ..")"
- local str2 = "CFrame.Angles("..returnDeg(AX)..sep..returnDeg(AY)..sep..returnDeg(AZ)..")"
- print(str1.." * "..str2)
- end
- function tablelerp(tab, speed)
- rooth.C0 = mlerp(df[1], tab[1], speed)
- rooth.C1 = mlerp(df[2], tab[2], speed)
- Neck.C0 = mlerp(df[3], tab[3], speed)
- Neck.C1 = mlerp(df[4], tab[4], speed)
- LS.C0 = mlerp(df[5], tab[5], speed)
- LS.C1 = mlerp(df[6], tab[6], speed)
- RS.C0 = mlerp(df[7], tab[7], speed)
- RS.C1 = mlerp(df[8], tab[8], speed)
- LH.C0 = mlerp(df[9], tab[9], speed)
- LH.C1 = mlerp(df[10], tab[10], speed)
- RH.C0 = mlerp(df[11], tab[11], speed)
- RH.C1 = mlerp(df[12], tab[12], speed)
- end
- function randomang(p)
- local pi = math.pi
- local rand = math.random
- p.CFrame = p.CFrame * CFrame.Angles(rand(-pi,pi),rand(-pi,pi),rand(-pi,pi))
- end
- local UV = function(Alpha)
- return math.sin((math.pi/2)*Alpha);
- end
- local InEasingDirection = function(Alpha)
- return math.sin((math.pi/2)-((math.pi/2)*Alpha));
- end
- local InOutEasingDirection = function(Alpha)
- return (1-math.cos(math.pi*Alpha))/2;
- end
- local runs = game:GetService('RunService')
- local hb = runs.Heartbeat
- local function outBack(t, b, c, d, s)
- if not s then s = 1.70158 end
- t = t / d - 1
- return c * (t * t * ((s + 1) * t + s) + 1) + b
- end
- local function outElastic(t, b, c, d, a, p)
- if t == 0 then return b end
- t = t / d
- if t == 1 then return b + c end
- if not p then p = d * 0.3 end
- local s
- if not a or a < math.abs(c) then
- a = c
- s = p / 4
- else
- s = p / (2 * math.pi) * math.asin(c/a)
- end
- return a * math.pow(2, -10 * t) * math.sin((t * d - s) * (2 * math.pi) / p) + c + b
- end
- --/ extra
- function brickfx(mode,minsize,maxsize,int,cf,color,mat,par,rel)
- if mode == 0 then
- local np = Instance.new("Part")
- np.Anchored = true
- np.CanCollide = false
- np.CFrame = cf
- if color ~= nil then
- np.Color = color
- end
- if mat ~= nil then
- np.Material = mat
- end
- np.Size = Vector3.new(1,1,1)
- np.Parent = par
- for i = minsize,maxsize,int do
- np.Transparency = i/maxsize
- if i ~= 0 then
- np.Size = Vector3.new(i*10,i*10,i*10)
- end
- randomang(np)
- swait(1)
- end
- debris:AddItem(np)
- elseif mode == 1 then
- local np = Instance.new("Part")
- np.Anchored = true
- np.CanCollide = false
- np.CFrame = root.CFrame:toWorldSpace(CFrame.new(0,0,0))
- np.Size = Vector3.new(1,1,1)
- np.Parent = char
- for i = minsize,maxsize,int do
- if i ~= 0 then
- np.Size = Vector3.new(i*10,i*10,i*10)
- end
- randomang(np)
- swait(1)
- end
- np:Destroy()
- end
- end
- -- please don't sue me osama i just used aimiengine
- function DetectHitbox(cframe,size)
- local CheckPoint = function(region3,poisition)
- for i,plane in pairs(region3) do
- local normal = plane[1]
- local point = plane[2]
- local relative = poisition - point
- if relative:Dot(normal)>0 then
- return false
- end
- end
- return true
- end
- local planes = {}
- local center = cframe
- local right = center:vectorToWorldSpace(Vector3.new(1,0,0))
- local left = center:vectorToWorldSpace(Vector3.new(-1,0,0))
- local front = center:vectorToWorldSpace(Vector3.new(0,0,-1))
- local back = center:vectorToWorldSpace(Vector3.new(0,0,1))
- local top = center:vectorToWorldSpace(Vector3.new(0,1,0))
- local bottom = center:vectorToWorldSpace(Vector3.new(0,-1,0))
- local rightPoint = center.p + right * (Vector3.new(1,0,0) * size/2).magnitude
- local leftPoint = center.p + left * (Vector3.new(-1,0,0) * size/2).magnitude
- local frontPoint = center.p + front * (Vector3.new(0,0,-1) * size/2).magnitude
- local backPoint = center.p + back * (Vector3.new(0,0,1) * size/2).magnitude
- local topPoint = center.p + top * (Vector3.new(0,1,0) * size/2).magnitude
- local bottomPoint = center.p + bottom * (Vector3.new(0,1,0) * size/2).magnitude
- planes={
- {right,rightPoint};
- {left,leftPoint};
- {front,frontPoint};
- {back,backPoint};
- {top,topPoint};
- {back,backPoint};
- }
- local targets = {}
- for _,x in pairs(workspace:GetChildren()) do
- local vhume = x:FindFirstChild("Humanoid")
- if vhume and vhume:IsA("Humanoid") and vhume ~= hum then
- for _,y in pairs(x:GetChildren()) do
- if y:IsA("BasePart") and not targets[x] and CheckPoint(planes,y.Position) then
- table.insert(targets, x)
- break
- end
- end
- end
- end
- return targets
- end
- local damagegui = char:WaitForChild("damagegui")
- damagegui.Enabled = false
- local guibin = Instance.new("Folder", char)
- guibin.Name = "guibin"
- function virusbust(h)
- local nchar = h.Parent
- nchar.Parent = char
- nchar:BreakJoints()
- debris:AddItem(nchar,frame*10)
- for i,v in pairs(nchar:GetDescendants()) do
- if v:IsA("BasePart") then
- spawn(function()
- local bv = Instance.new("BodyVelocity")
- bv.Velocity = root.CFrame.upVector * 30
- bv.Parent = v
- for i = 0,1,.1 do
- if not v.Parent then break end
- v.Transparency = i
- swait()
- end
- end)
- end
- end
- end
- function damagehum(h,amount)
- local gui = damagegui:Clone()
- local enemy = h.Parent
- local root = h.Parent:FindFirstChild("HumanoidRootPart")
- local head = h.Parent:FindFirstChild("Head")
- if h.Health <= amount or h.Health == math.huge or h.Health > 5000 then
- virusbust(h)
- else
- h:TakeDamage(amount)
- end
- gui.Parent = guibin
- gui.Enabled = true
- gui.Adornee = head
- gui.Frame.TextLabel.Text = "-"..amount
- for i = 0,1.01,.01 do
- gui.Frame.TextLabel.TextTransparency = i
- swait()
- end
- debris:AddItem(gui)
- end
- function cannontrail(shot,rate)
- spawn(function()
- while shot.Parent do
- brickfx(0,0.05,0.5,0.05,shot.CFrame,Color3.fromRGB(122,107,47),"Neon",shot)
- wait(rate)
- end
- end)
- end
- function cannonbullet(dmg,speed)
- local cdb = false
- local shot = cannonshot:Clone()
- local rate = .15
- local mid = shot.mid
- shot.PrimaryPart = mid
- shot:SetPrimaryPartCFrame(cannon.barrelin.CFrame * CFrame.Angles(0,math.pi,0))
- shot.Parent = char
- local thrust = Instance.new("BodyVelocity")
- thrust.Velocity = cannon.barrelin.CFrame.rightVector * speed * -1
- thrust.Parent = shot.PrimaryPart
- cannontrail(mid,rate)
- mid.Touched:connect(function(h)
- if h.Parent:FindFirstChild("Humanoid") and h.Parent:FindFirstChild("Humanoid") ~= hum then
- brickfx(0,0.1,1,0.1,mid.CFrame,Color3.fromRGB(122,107,47),"Neon")
- damagehum(h.Parent:FindFirstChild("Humanoid"),dmg)
- print("Virus hit for "..dmg.." damage!")
- shot:Destroy()
- end
- end)
- debris:AddItem(shot,10)
- end
- --// garbage removal
- -- debris:AddItem(script,1)
- guibin.DescendantAdded:connect(function(d)
- wait(10)
- if d ~= nil then
- debris:AddItem(d,.2)
- end
- end)
- fulltransparent(cannon,1)
- --// the main event
- iservice.InputBegan:connect(function(io,gp)
- if io.KeyCode == Enum.KeyCode.Q then
- Cannon()
- end
- end)
- local function endanims(f)
- local curtracks = hum:GetPlayingAnimationTracks()
- for i = 1,#curtracks do curtracks[i]:Stop(f or 0) end
- end
- local cannondb = false
- function Cannon()
- if cannondb == false then
- cannondb = true
- animate.Disabled = true
- animate.Parent = nil
- animator.Parent = nil
- endanims()
- tablelerp(df,1)
- local ws = hum.WalkSpeed
- hum.WalkSpeed = 0
- wait()
- spawn(function()
- for i = 1,-0.05,-.05 do
- fulltransparent(cannon,i)
- swait()
- end
- end)
- for i = 0,frame*10,frame do
- tablelerp(CannonShoot[1],i/(frame*10))
- swait()
- end
- cannonbullet(40,100)
- firesound:Play()
- brickfx(0,0.05,0.5,0.05,cannon.barrelin.CFrame,Color3.fromRGB(122,107,47),"Neon")
- for i = 0,frame*20,frame do
- local elasi = outElastic(i/(frame*20),0,1,1)
- tablelerp(CannonShoot[2],elasi)
- swait()
- end
- tablelerp(df,1)
- spawn(function()
- for i = 0,1,.1 do
- fulltransparent(cannon,i)
- swait()
- end
- end)
- animate.Disabled = false
- animator.Parent = hum
- animate.Parent = char
- hum.WalkSpeed = ws
- cannondb = false
- end
- end
Add Comment
Please, Sign In to add comment