Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- 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"))
- Tool0 = Instance.new("Tool")
- Part1 = Instance.new("Part")
- LocalScript2 = Instance.new("LocalScript")
- Sound3 = Instance.new("Sound")
- Sound4 = Instance.new("Sound")
- SpecialMesh5 = Instance.new("SpecialMesh")
- Decal6 = Instance.new("Decal")
- Animation7 = Instance.new("Animation")
- Animation8 = Instance.new("Animation")
- Animation9 = Instance.new("Animation")
- Camera10 = Instance.new("Camera")
- Tool0.Name = "Murderer's Knife"
- Tool0.Parent = mas
- Tool0.TextureId = "rbxassetid://394536085"
- Tool0.Grip = CFrame.new(-0.132188454, -0.118292309, -0.183755353, -0.999465764, 0.00433513476, -0.0323996544, 0.00573933125, 0.999042571, -0.0433746353, 0.0321805477, -0.0435373336, -0.998533487)
- Tool0.GripForward = Vector3.new(0.0323996544, 0.0433746353, 0.998533487)
- Tool0.GripPos = Vector3.new(-0.132188454, -0.118292309, -0.183755353)
- Tool0.GripRight = Vector3.new(-0.999465764, 0.00573933125, 0.0321805477)
- Tool0.GripUp = Vector3.new(0.00433513476, 0.999042571, -0.0435373336)
- Tool0.ToolTip = "Stabby wabby :3"
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.CFrame = CFrame.new(-51.6436462, 3.17445302, -19.7466812, 0, 0.0382429808, -0.999268532, 0, 0.999268532, 0.0382429808, 1, 0, 0)
- Part1.Orientation = Vector3.new(-2.19000006, -90, 0)
- Part1.Position = Vector3.new(-51.6436462, 3.17445302, -19.7466812)
- Part1.Rotation = Vector3.new(-90, -87.8099976, -90)
- Part1.Color = Color3.new(0.388235, 0.372549, 0.384314)
- Part1.Size = Vector3.new(0.200000003, 3.9199934, 0.829999506)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.BrickColor = BrickColor.new("Dark stone grey")
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.brickColor = BrickColor.new("Dark stone grey")
- Part1.FormFactor = Enum.FormFactor.Custom
- Part1.formFactor = Enum.FormFactor.Custom
- LocalScript2.Name = "MacheteScript"
- LocalScript2.Parent = Part1
- table.insert(cors,sandbox(LocalScript2,function()
- ------------------------
- --[[UTIL Functions]]--
- ------------------------
- --Global functions used by all classes are wrapped in UTIL
- --deal with it.
- local UTIL = {}
- function UTIL.Class(tableIn,template)
- tableIn = tableIn or {}
- local mt = {
- __metatable = UTIL.DeepCopy(template);
- __index = UTIL.DeepCopy(template);
- }
- return setmetatable(tableIn, mt)
- end
- function UTIL.MakeClass(...)
- local arg = {...}
- assert(#arg>0, 'ERROR: class needs 1 argument or more')
- local members = arg[1]
- for i=2,#arg,1 do
- if type(arg[i])=='table' then
- for key,val in pairs(arg[i]) do
- if not members[key] then
- members[key] = val
- end
- end
- end
- end
- local function New(init)
- return UTIL.Class(init or {},members)
- end
- local function Copy(obj, ...)
- local newobj = obj:New(unpack(arg))
- for n,v in pairs(obj) do newobj[n] = v end
- return newobj
- end
- members.New = New
- members.Copy = Copy
- return mt
- end
- function UTIL.DeepCopy(orig)
- local orig_type = type(orig)
- local copy
- if orig_type == 'table' then
- copy = {}
- for orig_key, orig_value in next, orig, nil do
- copy[UTIL.DeepCopy(orig_key)] = UTIL.DeepCopy(orig_value)
- end
- setmetatable(copy, UTIL.DeepCopy(getmetatable(orig)))
- else -- number, string, boolean, etc
- copy = orig
- end
- return copy
- end
- function UTIL.Instantiate(guiType)
- return function(data)
- local obj = Instance.new(guiType)
- for k, v in pairs(data) do
- if type(k) == 'number' then
- v.Parent = obj
- else
- obj[k] = v
- end
- end
- return obj
- end
- end
- function UTIL.RetroRegister(func,...)
- func()
- for _,i in ipairs({...}) do
- i:connect(func)
- end
- end
- -- Waits for a new character to be added if the current one is invalid
- -- (Ensures that you don't have the old dead character after a respawn)
- function UTIL.WaitForValidCharacter(player)
- local character = player.Character
- if not character or not character.Parent or not character:FindFirstChild('Humanoid') or character.Humanoid.Health <= 0 then
- player.CharacterAdded:wait()
- wait(0) --NOTE: Necessary for server scripts executing on the same event
- character = player.Character
- end
- return character
- end
- -- Returns a character ancestor and its Humanoid, or nil
- function UTIL.FindCharacterAncestor(subject)
- if subject and subject ~= Workspace then
- local humanoid = subject:FindFirstChild('Humanoid')
- if humanoid then
- return subject, humanoid
- else
- return UTIL.FindCharacterAncestor(subject.Parent)
- end
- end
- return nil
- end
- UTIL.AssetURL = 'http://www.roblox.com/asset/?id='
- UTIL.TouchEnabled = game:GetService("UserInputService").TouchEnabled
- do
- local suceeded,_ =pcall(function() game.Workspace.CurrentCamera:GetPanSpeed() end)
- UTIL.CanCheckPanSpeed = suceeded
- end
- local DebrisService = Game:GetService('Debris')
- local DebugPrintOffset = 0
- function UTIL.Dprint(...)
- local line = ''
- for _, segment in pairs({...}) do
- line = line .. (line and ' ' or '') .. tostring(segment)
- end
- local gui = Instance.new('ScreenGui')
- local label = Instance.new('TextLabel')
- label.Text = line
- label.Size = UDim2.new(0.25, 0, 0.05, 0)
- label.BackgroundTransparency = 0.5
- label.Position = UDim2.new(0, 0, 0, DebugPrintOffset)
- label.TextWrapped = true
- label.Parent = gui
- DebrisService:AddItem(gui, 30)
- gui.Parent = script.Parent
- DebugPrintOffset = (DebugPrintOffset <= 600) and DebugPrintOffset + 30 or 0
- end
- --
- --All Welding Related Utility functions should be put here
- --
- WeldUtil = {}
- do
- function WeldUtil.WeldBetween(a, b)
- local weld = Instance.new("Weld")
- weld.Part0 = a
- weld.Part1 = b
- weld.C0 = CFrame.new()
- weld.C1 = b.CFrame:inverse() * a.CFrame
- weld.Parent = a
- return weld
- end
- function WeldUtil:PermaWeld(weld)
- local OriginalParent = weld.Parent
- weld.Changed:connect(function()
- Delay(0,function() weld.Parent = OriginalParent end)
- end)
- end
- end
- local InternalEvent =
- {
- Listeners = nil,
- }
- do
- UTIL.MakeClass(InternalEvent)
- function InternalEvent:Connect(func)
- if not self.Listeners then self.Listeners = {} end
- table.insert(self.Listeners,func)
- end
- function InternalEvent:Fire(...)
- if not self.Listeners then return end
- local args = {...}
- for _,i in ipairs(self.Listeners) do
- Spawn(function() i(unpack(args)) end)
- end
- end
- end
- --[[Sword Part Class]]--
- local SwordPart =
- {
- Damage = 50,
- AttackTime = 0.5,
- CoolDown = 0,
- LastSwing = 0,
- LastHit = 0,
- Part= nil,
- Owner = nil,--player object that owns this sword
- OnHit = nil,
- OnHitHumanoid = nil,
- OnAttackReady = nil,
- OnAttack = nil,
- SwingSound = nil,
- HitSound = nil,
- SwingAnimation = nil, --animation track!
- ActiveConnections = {},
- }
- do
- UTIL.MakeClass(SwordPart)
- function SwordPart.New(npart,nowner)
- local init= UTIL.DeepCopy(SwordPart)
- init.Part= npart
- init.Owner = nowner
- table.insert(init.ActiveConnections,init.Part.Touched:connect(function(hit) init:SwordTouch(hit) end))
- init.OnHit = InternalEvent.New()
- init.OnHitHumanoid = InternalEvent.New()
- init.OnAttackReady = InternalEvent.New()
- init.OnAttack = InternalEvent.New()
- return init
- end
- function SwordPart:SwordTouch(hit)
- if tick()-self.LastSwing >self.AttackTime or tick()-self.LastHit<self.AttackTime then return end
- self.OnHit:Fire(hit)
- local character,humanoid = UTIL.FindCharacterAncestor(hit)
- if character and character ~= self.Owner.Character then
- humanoid:TakeDamage(self.Damage)
- self.OnHitHumanoid:Fire(humanoid,hit)
- self.LastHit = tick()
- if self.HitSound then
- self.HitSound:Play()
- end
- end
- end
- function SwordPart:DoSwing()
- if tick()-self.LastSwing<self.AttackTime+self.CoolDown then
- return
- end
- if self.SwingAnimation then
- self.SwingAnimation:Play()
- end
- if self.SwingSound then
- self.SwingSound:Play()
- end
- self.LastSwing = tick()
- self.OnAttack:Fire()
- end
- function SwordPart:Destroy()
- for _,i in pairs(self.ActiveConnections) do
- i:disconnect()
- end
- end
- end
- do
- local Handle = script.Parent
- local Tool = Handle.Parent
- local Player = game.Players.LocalPlayer
- local Character = UTIL.WaitForValidCharacter(Player)
- local SwingAni = UTIL.Instantiate"Animation"
- {AnimationId = "http://www.roblox.com/Asset?ID=89289879"}
- local HitSound = Handle:WaitForChild('Hit')
- local SwingSound = Handle:WaitForChild('Swing')
- local SwingAniTrack
- local Sword
- Tool.Equipped:connect(function(mouse)
- Sword = SwordPart.New(Handle,Player)
- Sword.Damage = 40
- Sword.HitSound = HitSound
- Sword.SwingSound = SwingSound
- Character = UTIL.WaitForValidCharacter(Player)
- local Humanoid = Character:FindFirstChild('Humanoid')
- SwingAniTrack = Humanoid:LoadAnimation(SwingAni)
- Sword.SwingAnimation = SwingAniTrack
- Sword.OnHitHumanoid:Connect(function(humanoid,hit)
- local myTorso = Character:FindFirstChild('Torso')
- local torso = humanoid.Parent:FindFirstChild('Torso')
- if not torso or not myTorso then return end
- if hit.Name=='Right Arm' or hit.Name=='Left Arm' or hit.Name=='Right Leg' or hit.Name=='Left Leg' then
- hit:BreakJoints()
- WeldUtil.WeldBetween(hit, Handle)
- Delay(1,function() hit:BreakJoints() end )
- end
- end)
- mouse.Button1Down:connect(function()
- Sword:DoSwing()
- end)
- end)
- Tool.Unequipped:connect(function()
- Sword:Destroy()
- end)
- end
- end))
- Sound3.Name = "Hit"
- Sound3.Parent = Part1
- Sound3.SoundId = "http://www.roblox.com/Asset?ID=123252378"
- Sound3.Volume = 1
- Sound4.Name = "Swing"
- Sound4.Parent = Part1
- Sound4.SoundId = "http://www.roblox.com/Asset?ID=119888724"
- Sound4.Volume = 1
- SpecialMesh5.Parent = Part1
- SpecialMesh5.MeshId = "rbxassetid://1553262626"
- SpecialMesh5.TextureId = "rbxassetid://1553262651"
- SpecialMesh5.MeshType = Enum.MeshType.FileMesh
- Decal6.Parent = Part1
- Decal6.Texture = "http://www.roblox.com/asset/?id=116830967"
- Decal6.Face = Enum.NormalId.Left
- Animation7.Name = "ShieldWalk"
- Animation7.Parent = Tool0
- Animation7.AnimationId = "http://www.roblox.com/Asset?ID=49763871"
- Animation8.Name = "QuickSlash"
- Animation8.Parent = Tool0
- Animation8.AnimationId = "http://www.roblox.com/Asset?ID=49815113"
- Animation9.Name = "ShieldBash"
- Animation9.Parent = Tool0
- Animation9.AnimationId = "http://www.roblox.com/Asset?ID=49907410"
- Camera10.Name = "ThumbnailCamera"
- Camera10.Parent = Tool0
- Camera10.CFrame = CFrame.new(10.8518162, 26.3124142, 50.5024376, -0.900446653, 0.0163968559, 0.434657425, 9.31322464e-10, 0.999289393, -0.0376968235, -0.434966534, -0.0339439772, -0.899806678)
- Camera10.CoordinateFrame = CFrame.new(10.8518162, 26.3124142, 50.5024376, -0.900446653, 0.0163968559, 0.434657425, 9.31322464e-10, 0.999289393, -0.0376968235, -0.434966534, -0.0339439772, -0.899806678)
- Camera10.FieldOfView = 9.999999825821
- Camera10.Focus = CFrame.new(9.98250103, 26.3878078, 52.3020515, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Camera10.focus = CFrame.new(9.98250103, 26.3878078, 52.3020515, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Backpack
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement