Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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")
- SpecialMesh2 = Instance.new("SpecialMesh")
- Sparkles3 = Instance.new("Sparkles")
- BoolValue4 = Instance.new("BoolValue")
- Sound5 = Instance.new("Sound")
- Sound6 = Instance.new("Sound")
- Script7 = Instance.new("Script")
- BoolValue8 = Instance.new("BoolValue")
- LocalScript9 = Instance.new("LocalScript")
- Tool0.Name = "Ice Dagger"
- Tool0.Parent = mas
- Tool0.TextureId = "http://www.roblox.com/asset/?id=97309798"
- Tool0.GripForward = Vector3.new(4.37113883e-08, -0, -1)
- Tool0.GripPos = Vector3.new(-4.80825264e-08, -0.900000036, -2.10175408e-15)
- Tool0.GripRight = Vector3.new(1, -4.37113883e-08, 4.37113883e-08)
- Tool0.GripUp = Vector3.new(4.37113883e-08, 1, 1.91068547e-15)
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.Locked = true
- Part1.FormFactor = Enum.FormFactor.Custom
- Part1.Size = Vector3.new(0.200000003, 2.5999999, 0.899999976)
- Part1.CFrame = CFrame.new(-430.100006, 2.50002098, 783.599976, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.Position = Vector3.new(-430.100006, 2.50002098, 783.599976)
- SpecialMesh2.Parent = Part1
- SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=96627177"
- SpecialMesh2.Scale = Vector3.new(1.20000005, 1.20000005, 1.20000005)
- SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=97308668"
- SpecialMesh2.MeshType = Enum.MeshType.FileMesh
- SpecialMesh2.Scale = Vector3.new(1.20000005, 1.20000005, 1.20000005)
- Sparkles3.Parent = Part1
- Sparkles3.Color = Color3.new(1.77083, 10.2, 0)
- Sparkles3.Enabled = false
- Sparkles3.SparkleColor = Color3.new(1, 1, 0)
- Sparkles3.Color = Color3.new(1.77083, 10.2, 0)
- BoolValue4.Name = "Blockable"
- BoolValue4.Parent = Part1
- BoolValue4.Value = true
- Sound5.Name = "Break"
- Sound5.Parent = Part1
- Sound5.SoundId = "rbxassetid://516789356"
- Sound6.Name = "Freeze"
- Sound6.Parent = Part1
- Sound6.SoundId = "rbxassetid://633759810"
- Script7.Name = "SwordScript"
- Script7.Parent = Tool0
- table.insert(cors,sandbox(Script7,function()
- -------- OMG HAX
- r = game:service("RunService")
- local damage = 5
- local slash_damage = 10
- local lunge_damage = 15
- sword = script.Parent.Handle
- Tool = script.Parent
- local SlashSound = Instance.new("Sound")
- SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
- SlashSound.Parent = sword
- SlashSound.Volume = .7
- local LungeSound = Instance.new("Sound")
- LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
- LungeSound.Parent = sword
- LungeSound.Volume = .6
- local UnsheathSound = Instance.new("Sound")
- UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
- UnsheathSound.Parent = sword
- UnsheathSound.Volume = 1
- local isDeadly = false
- function toggleDeadly(on)
- isDeadly = on
- if (on == true) then
- Tool.Handle.BrickColor = BrickColor.new(23)
- else
- Tool.Handle.BrickColor = BrickColor.new(1)
- end
- end
- function FreezeKill(character, humanoid, attacker)
- if (character:FindFirstChild("ForceField") ~= nil) then return end
- if (character:FindFirstChild("Firebrand") ~= nil) then return end
- tagHumanoid(humanoid, attacker)
- local childs = character:GetChildren()
- local freezecheck = character:FindFirstChild("AlreadyFrozen")
- if freezecheck == nil then
- local clone = script.Parent.AlreadyFrozen:Clone()
- clone.Parent = character
- local colors = {}
- for i=1,#childs do
- if (childs[i].className == "Part") then
- colors[i] = childs[i].BrickColor
- childs[i].BrickColor = BrickColor.new(11)
- childs[i].Transparency = .5
- childs[i].Material = "Ice"
- childs[i].Anchored = true
- script.Parent.Handle.Freeze:Play()
- end
- end
- wait(2)
- for i=1,#childs do
- if (childs[i].className == "Part") then
- childs[i].Anchored = false
- script.Parent.Handle.Break:Play()
- end
- end
- humanoid.Parent:BreakJoints()
- end
- end
- function blow(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- local vCharacter = Tool.Parent
- local vPlayer = game.Players:playerFromCharacter(vCharacter)
- local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
- if humanoid~=nil and humanoid ~= hum and hum ~= nil then
- -- final check, make sure sword is in-hand
- local right_arm = vCharacter:FindFirstChild("Right Arm")
- if (right_arm ~= nil) then
- local joint = right_arm:FindFirstChild("RightGrip")
- if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
- if (isDeadly == true) then
- FreezeKill(humanoid.Parent, humanoid, vPlayer)
- else
- tagHumanoid(humanoid, vPlayer)
- humanoid:TakeDamage(damage)
- wait(1)
- untagHumanoid(humanoid)
- end
- end
- end
- end
- end
- function tagHumanoid(humanoid, player)
- local creator_tag = Instance.new("ObjectValue")
- creator_tag.Value = player
- creator_tag.Name = "creator"
- creator_tag.Parent = humanoid
- end
- function untagHumanoid(humanoid)
- if humanoid ~= nil then
- local tag = humanoid:findFirstChild("creator")
- if tag ~= nil then
- tag.Parent = nil
- end
- end
- end
- function attack()
- damage = slash_damage
- SlashSound:play()
- local anim = Instance.new("StringValue")
- anim.Name = "toolanim"
- anim.Value = "Slash"
- anim.Parent = Tool
- end
- function lunge()
- damage = lunge_damage
- LungeSound:play()
- local anim = Instance.new("StringValue")
- anim.Name = "toolanim"
- anim.Value = "Lunge"
- anim.Parent = Tool
- local force = Instance.new("BodyVelocity")
- force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
- force.Parent = Tool.Parent.Torso
- wait(.25)
- swordOut()
- wait(.25)
- force.Parent = nil
- wait(.5)
- swordUp()
- damage = slash_damage
- end
- function swordUp()
- Tool.GripUp = Vector3.new(0,1,0)
- end
- function swordOut()
- Tool.GripUp = Vector3.new(0,0,1)
- end
- function swordAcross()
- -- parry
- end
- Tool.Enabled = true
- local last_attack = 0
- function onActivated()
- if not Tool.Enabled then
- return
- end
- Tool.Enabled = false
- local character = Tool.Parent;
- local humanoid = character.Humanoid
- if humanoid == nil then
- print("Humanoid not found")
- return
- end
- t = r.Stepped:wait()
- if (t - last_attack < .2) then
- lunge()
- else
- attack()
- end
- last_attack = t
- --wait(.5)
- Tool.Enabled = true
- end
- function onEquipped()
- toggleDeadly(false)
- wait(3)
- toggleDeadly(true)
- UnsheathSound:play()
- end
- function onUnequipped()
- toggleDeadly(false)
- end
- script.Parent.Activated:connect(onActivated)
- script.Parent.Equipped:connect(onEquipped)
- script.Parent.Unequipped:connect(onUnequipped)
- connection = sword.Touched:connect(blow)
- end))
- BoolValue8.Name = "AlreadyFrozen"
- BoolValue8.Parent = Tool0
- LocalScript9.Name = "Local Gui"
- LocalScript9.Parent = Tool0
- 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