Advertisement
Kaemi

Untitled

Mar 15th, 2018
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.25 KB | None | 0 0
  1. function sandbox(var,func)
  2. local env = getfenv(func)
  3. local newenv = setmetatable({},{
  4. __index = function(self,k)
  5. if k=="script" then
  6. return var
  7. else
  8. return env[k]
  9. end
  10. end,
  11. })
  12. setfenv(func,newenv)
  13. return func
  14. end
  15. cors = {}
  16. mas = Instance.new("Model",game:GetService("Lighting"))
  17. Tool0 = Instance.new("Tool")
  18. Part1 = Instance.new("Part")
  19. SpecialMesh2 = Instance.new("SpecialMesh")
  20. Sparkles3 = Instance.new("Sparkles")
  21. BoolValue4 = Instance.new("BoolValue")
  22. Sound5 = Instance.new("Sound")
  23. Sound6 = Instance.new("Sound")
  24. Script7 = Instance.new("Script")
  25. BoolValue8 = Instance.new("BoolValue")
  26. LocalScript9 = Instance.new("LocalScript")
  27. Tool0.Name = "Ice Dagger"
  28. Tool0.Parent = mas
  29. Tool0.TextureId = "http://www.roblox.com/asset/?id=97309798"
  30. Tool0.GripForward = Vector3.new(4.37113883e-08, -0, -1)
  31. Tool0.GripPos = Vector3.new(-4.80825264e-08, -0.900000036, -2.10175408e-15)
  32. Tool0.GripRight = Vector3.new(1, -4.37113883e-08, 4.37113883e-08)
  33. Tool0.GripUp = Vector3.new(4.37113883e-08, 1, 1.91068547e-15)
  34. Part1.Name = "Handle"
  35. Part1.Parent = Tool0
  36. Part1.Locked = true
  37. Part1.FormFactor = Enum.FormFactor.Custom
  38. Part1.Size = Vector3.new(0.200000003, 2.5999999, 0.899999976)
  39. Part1.CFrame = CFrame.new(-430.100006, 2.50002098, 783.599976, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  40. Part1.BottomSurface = Enum.SurfaceType.Smooth
  41. Part1.TopSurface = Enum.SurfaceType.Smooth
  42. Part1.Position = Vector3.new(-430.100006, 2.50002098, 783.599976)
  43. SpecialMesh2.Parent = Part1
  44. SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=96627177"
  45. SpecialMesh2.Scale = Vector3.new(1.20000005, 1.20000005, 1.20000005)
  46. SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=97308668"
  47. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  48. SpecialMesh2.Scale = Vector3.new(1.20000005, 1.20000005, 1.20000005)
  49. Sparkles3.Parent = Part1
  50. Sparkles3.Color = Color3.new(1.77083, 10.2, 0)
  51. Sparkles3.Enabled = false
  52. Sparkles3.SparkleColor = Color3.new(1, 1, 0)
  53. Sparkles3.Color = Color3.new(1.77083, 10.2, 0)
  54. BoolValue4.Name = "Blockable"
  55. BoolValue4.Parent = Part1
  56. BoolValue4.Value = true
  57. Sound5.Name = "Break"
  58. Sound5.Parent = Part1
  59. Sound5.SoundId = "rbxassetid://516789356"
  60. Sound6.Name = "Freeze"
  61. Sound6.Parent = Part1
  62. Sound6.SoundId = "rbxassetid://633759810"
  63. Script7.Name = "SwordScript"
  64. Script7.Parent = Tool0
  65. table.insert(cors,sandbox(Script7,function()
  66. -------- OMG HAX
  67.  
  68. r = game:service("RunService")
  69.  
  70.  
  71. local damage = 5
  72.  
  73.  
  74. local slash_damage = 10
  75. local lunge_damage = 15
  76.  
  77. sword = script.Parent.Handle
  78. Tool = script.Parent
  79.  
  80.  
  81. local SlashSound = Instance.new("Sound")
  82. SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
  83. SlashSound.Parent = sword
  84. SlashSound.Volume = .7
  85.  
  86. local LungeSound = Instance.new("Sound")
  87. LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
  88. LungeSound.Parent = sword
  89. LungeSound.Volume = .6
  90.  
  91. local UnsheathSound = Instance.new("Sound")
  92. UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
  93. UnsheathSound.Parent = sword
  94. UnsheathSound.Volume = 1
  95.  
  96. local isDeadly = false
  97.  
  98. function toggleDeadly(on)
  99. isDeadly = on
  100. if (on == true) then
  101. Tool.Handle.BrickColor = BrickColor.new(23)
  102. else
  103. Tool.Handle.BrickColor = BrickColor.new(1)
  104. end
  105. end
  106.  
  107. function FreezeKill(character, humanoid, attacker)
  108.  
  109. if (character:FindFirstChild("ForceField") ~= nil) then return end
  110. if (character:FindFirstChild("Firebrand") ~= nil) then return end
  111.  
  112.  
  113. tagHumanoid(humanoid, attacker)
  114.  
  115. local childs = character:GetChildren()
  116. local freezecheck = character:FindFirstChild("AlreadyFrozen")
  117. if freezecheck == nil then
  118. local clone = script.Parent.AlreadyFrozen:Clone()
  119. clone.Parent = character
  120.  
  121. local colors = {}
  122.  
  123. for i=1,#childs do
  124. if (childs[i].className == "Part") then
  125. colors[i] = childs[i].BrickColor
  126. childs[i].BrickColor = BrickColor.new(11)
  127. childs[i].Transparency = .5
  128. childs[i].Material = "Ice"
  129. childs[i].Anchored = true
  130. script.Parent.Handle.Freeze:Play()
  131. end
  132. end
  133.  
  134. wait(2)
  135.  
  136. for i=1,#childs do
  137. if (childs[i].className == "Part") then
  138. childs[i].Anchored = false
  139. script.Parent.Handle.Break:Play()
  140. end
  141. end
  142.  
  143.  
  144.  
  145. humanoid.Parent:BreakJoints()
  146.  
  147. end
  148. end
  149.  
  150.  
  151.  
  152.  
  153. function blow(hit)
  154. local humanoid = hit.Parent:findFirstChild("Humanoid")
  155. local vCharacter = Tool.Parent
  156. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  157. local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
  158. if humanoid~=nil and humanoid ~= hum and hum ~= nil then
  159. -- final check, make sure sword is in-hand
  160.  
  161. local right_arm = vCharacter:FindFirstChild("Right Arm")
  162. if (right_arm ~= nil) then
  163. local joint = right_arm:FindFirstChild("RightGrip")
  164. if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
  165. if (isDeadly == true) then
  166. FreezeKill(humanoid.Parent, humanoid, vPlayer)
  167. else
  168. tagHumanoid(humanoid, vPlayer)
  169. humanoid:TakeDamage(damage)
  170. wait(1)
  171. untagHumanoid(humanoid)
  172. end
  173. end
  174. end
  175.  
  176.  
  177. end
  178. end
  179.  
  180.  
  181.  
  182. function tagHumanoid(humanoid, player)
  183. local creator_tag = Instance.new("ObjectValue")
  184. creator_tag.Value = player
  185. creator_tag.Name = "creator"
  186. creator_tag.Parent = humanoid
  187. end
  188.  
  189. function untagHumanoid(humanoid)
  190. if humanoid ~= nil then
  191. local tag = humanoid:findFirstChild("creator")
  192. if tag ~= nil then
  193. tag.Parent = nil
  194. end
  195. end
  196. end
  197.  
  198.  
  199. function attack()
  200. damage = slash_damage
  201. SlashSound:play()
  202. local anim = Instance.new("StringValue")
  203. anim.Name = "toolanim"
  204. anim.Value = "Slash"
  205. anim.Parent = Tool
  206. end
  207.  
  208. function lunge()
  209. damage = lunge_damage
  210.  
  211. LungeSound:play()
  212.  
  213. local anim = Instance.new("StringValue")
  214. anim.Name = "toolanim"
  215. anim.Value = "Lunge"
  216. anim.Parent = Tool
  217.  
  218.  
  219. local force = Instance.new("BodyVelocity")
  220. force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
  221. force.Parent = Tool.Parent.Torso
  222. wait(.25)
  223. swordOut()
  224. wait(.25)
  225. force.Parent = nil
  226. wait(.5)
  227. swordUp()
  228.  
  229. damage = slash_damage
  230. end
  231.  
  232. function swordUp()
  233. Tool.GripUp = Vector3.new(0,1,0)
  234. end
  235.  
  236. function swordOut()
  237. Tool.GripUp = Vector3.new(0,0,1)
  238. end
  239.  
  240. function swordAcross()
  241. -- parry
  242. end
  243.  
  244.  
  245. Tool.Enabled = true
  246. local last_attack = 0
  247. function onActivated()
  248.  
  249. if not Tool.Enabled then
  250. return
  251. end
  252.  
  253. Tool.Enabled = false
  254.  
  255. local character = Tool.Parent;
  256. local humanoid = character.Humanoid
  257. if humanoid == nil then
  258. print("Humanoid not found")
  259. return
  260. end
  261.  
  262. t = r.Stepped:wait()
  263.  
  264. if (t - last_attack < .2) then
  265. lunge()
  266. else
  267. attack()
  268. end
  269.  
  270. last_attack = t
  271.  
  272. --wait(.5)
  273.  
  274. Tool.Enabled = true
  275. end
  276.  
  277.  
  278. function onEquipped()
  279. toggleDeadly(false)
  280. wait(3)
  281. toggleDeadly(true)
  282. UnsheathSound:play()
  283. end
  284.  
  285.  
  286. function onUnequipped()
  287. toggleDeadly(false)
  288. end
  289.  
  290. script.Parent.Activated:connect(onActivated)
  291. script.Parent.Equipped:connect(onEquipped)
  292. script.Parent.Unequipped:connect(onUnequipped)
  293.  
  294.  
  295. connection = sword.Touched:connect(blow)
  296.  
  297.  
  298.  
  299. end))
  300. BoolValue8.Name = "AlreadyFrozen"
  301. BoolValue8.Parent = Tool0
  302. LocalScript9.Name = "Local Gui"
  303. LocalScript9.Parent = Tool0
  304. for i,v in pairs(mas:GetChildren()) do
  305. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  306. pcall(function() v:MakeJoints() end)
  307. end
  308. mas:Destroy()
  309. for i,v in pairs(cors) do
  310. spawn(function()
  311. pcall(v)
  312. end)
  313. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement