Advertisement
Guest User

Untitled

a guest
Apr 29th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.61 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. local ReplicatedStore = game.ReplicatedStorage
  3. local GameContent = ReplicatedStore:WaitForChild("GameContent")
  4. local RevolverContent = GameContent:WaitForChild("RevolverContent")
  5. local RevolverSkins = RevolverContent:WaitForChild("RevolverSkins")
  6. local KnifeContent = GameContent:WaitForChild("KnifeContent")
  7. local KnifeSkins = KnifeContent:WaitForChild("KnifeSkins")
  8. local RadioContent = GameContent:WaitForChild("RadioContent")
  9. local RadioSkins = RadioContent:WaitForChild("RadioSkins")
  10.  
  11. local CurrRevolver = ""
  12. local CurrKnife = ""
  13. local CurrRadio = ""
  14.  
  15.  
  16. local rev_part, rev_mesh = nil, nil
  17. local knf_part, knf_mesh = nil, nil
  18. local rad_part, rad_mesh = nil, nil
  19.  
  20. local SettingsOffset = {
  21. KnifeBack = CFrame.new(0, 0, 0.58) * CFrame.Angles(math.rad(-90), math.rad(-45), math.rad(-90)),
  22. KnifeLeft = CFrame.new(-0.55, 0.51, -0.13) * CFrame.Angles(math.rad(125), math.rad(180), math.rad(0)),
  23. KnifeScaleRatio = 1.2,
  24. RevolverRight = CFrame.new(0.5, 0.25, 0) * CFrame.Angles(math.rad(-25), 0, math.rad(180)),
  25. RadioBack = CFrame.new(0, 0, 1) * CFrame.Angles(0, math.rad(180), math.rad(45)),
  26. RevolverScaleRatio = 1.2,
  27. }
  28.  
  29. local GetItemFromKeyHolder = function(KeyHolder, ItemName)
  30. for _, holder in pairs(KeyHolder:GetChildren()) do
  31. if holder.ClassName == "Model" then
  32. if holder.Name == ItemName then
  33. return holder
  34. end
  35. elseif holder.ClassName == "Folder" then
  36. for _, item in pairs(holder:GetChildren()) do
  37. if item.ClassName == "Model" then
  38. if item.Name == ItemName then
  39. return item
  40. end
  41. end
  42. end
  43. end
  44. end
  45. end
  46.  
  47. function CreatePart()
  48. local npart = Instance.new("Part")
  49. npart.CanCollide = false
  50. npart.BrickColor = BrickColor.new("Really black")
  51. npart.formFactor = "Custom"
  52. npart.Size = Vector3.new(0.2, 0.2, 0.2)
  53.  
  54. for _, surf_enum in pairs(Enum.NormalId:GetEnumItems()) do
  55. npart[surf_enum.Name .. "Surface"] = "SmoothNoOutlines"
  56. end
  57.  
  58. return npart
  59. end
  60.  
  61.  
  62. local function GenItemObject(class_type, object_data)
  63. local npart = CreatePart()
  64.  
  65. if object_data.Transparency then
  66. npart.Transparency = object_data.Transparency
  67. end
  68.  
  69. local nmesh = Instance.new("SpecialMesh")
  70. nmesh.MeshType = "FileMesh"
  71. nmesh.MeshId = object_data.Mesh
  72. nmesh.TextureId = object_data.Texture
  73.  
  74. nmesh.Parent = npart
  75.  
  76. return npart, nmesh
  77. end
  78.  
  79. local function GetChar()
  80. local g_char = player.Character
  81. if g_char ~= nil then
  82. local hum = g_char:FindFirstChild("Humanoid")
  83. local t = g_char:FindFirstChild("Torso")
  84. if hum ~= nil and t ~= nil then
  85. if hum.Health > 0 then
  86. return true, g_char, t, hum
  87. else
  88. return false, g_char, t, hum
  89. end
  90. end
  91. end
  92. return false, nil, nil, nil
  93. end
  94.  
  95. local function GetItemData(Class)
  96. if Class == "Revolver" then
  97. local RevolverData = GetItemFromKeyHolder(RevolverSkins, CurrRevolver)
  98. if RevolverData ~= nil then
  99. local RevolverAppearance = RevolverData:WaitForChild("RevolverApp")
  100. return unpack(require(RevolverAppearance))
  101. end
  102. end
  103. if Class == "Knife" then
  104. local KnifeData = GetItemFromKeyHolder(KnifeSkins, CurrKnife)
  105. if KnifeData ~= nil then
  106. local KnifeAppearance = KnifeData:WaitForChild("KnifeApp")
  107. return unpack(require(KnifeAppearance))
  108. end
  109. end
  110. if Class == "Radio" then
  111. local RadioData = GetItemFromKeyHolder(RadioSkins, CurrRadio)
  112. if RadioData ~= nil then
  113. local RadioAppearance = RadioData:WaitForChild("RadioAppearance")
  114. return unpack(require(RadioAppearance))
  115. end
  116. end
  117. return nil
  118. end
  119.  
  120.  
  121.  
  122. local function SetupItem(class_type)
  123. local item_data = GetItemData(class_type)
  124. local alive, char = GetChar()
  125.  
  126. if (not alive) or (not item_data) then return end
  127. local Part, Mesh = GenItemObject(class_type, item_data)
  128.  
  129. local new_w = Instance.new("Weld")
  130. new_w.Name = "RadioWeld"
  131. new_w.Part1 = Part
  132. Part.Parent = char
  133.  
  134. local RadioEquipped = (CurrRadio ~= "" and CurrRadio ~= nil)
  135.  
  136. if class_type == "Radio" then
  137. if rad_part then rad_part:Remove() end
  138.  
  139. Mesh.Scale = item_data.RadioScale
  140. new_w.C0 = item_data.RadioOffset * SettingsOffset.RadioBack
  141. new_w.Part0 = char["Torso"]
  142. new_w.Parent = char["Torso"]
  143. local rad_part, rad_mesh = Part, Mesh
  144. elseif class_type == "Knife" then
  145. if knf_part then knf_part:Remove() end
  146.  
  147. Mesh.Scale = item_data.WeaponScale * SettingsOffset.KnifeScaleRatio
  148. if RadioEquipped then
  149. new_w.Part0 = char["Left Leg"]
  150. new_w.Parent = char["Left Leg"]
  151. new_w.C0 = item_data.WeaponOffset * SettingsOffset.KnifeLeft
  152. else
  153. new_w.Part0 = char["Torso"]
  154. new_w.Parent = char["Torso"]
  155. new_w.C0 = item_data.WeaponOffset * SettingsOffset.KnifeBack
  156. end
  157. local knf_part, knf_mesh = Part, Mesh
  158. elseif class_type == "Revolver" then
  159. if rev_part then rev_part:Remove() end
  160.  
  161. Mesh.Scale = item_data.WeaponScale * SettingsOffset.RevolverScaleRatio
  162. new_w.Part0 = char["Right Leg"]
  163. new_w.Parent = char["Right Leg"]
  164. new_w.C0 = item_data.WeaponOffset * SettingsOffset.RevolverRight
  165. local rev_part, rev_mesh = Part, Mesh
  166. end
  167. end
  168.  
  169.  
  170.  
  171. local function UpdateSelections()
  172. local RadioName = "Default" --//GetFromClientData
  173. local KnifeName = "Default" --//GetFromClientData
  174. local RevolverName = "Default" --//GetFromClientData
  175.  
  176. if not GetChar() then return end
  177.  
  178. if CurrRadio ~= RadioName then
  179. CurrRadio = RadioName
  180. SetupItem("Radio")
  181.  
  182. end
  183.  
  184. if CurrRevolver ~= RevolverName then
  185. CurrRevolver = RevolverName
  186. SetupItem("Revolver")
  187.  
  188. end
  189.  
  190. if CurrKnife ~= KnifeName then
  191. CurrKnife = KnifeName
  192. SetupItem("Knife")
  193.  
  194. end
  195. end
  196.  
  197. --CLIENT_DATA.PlayerProfileChanged.Event:connect(UpdateSelections)
  198. UpdateSelections()
  199.  
  200.  
  201. local g_char = player.Character
  202. if g_char ~= nil then
  203. local hum = g_char:FindFirstChild("Humanoid")
  204. local t = g_char:FindFirstChild("Torso")
  205. if hum ~= nil and t ~= nil then
  206. if hum.Health > 0 then
  207. CurrentCharacter = g_char
  208. CurrentTorso = t
  209. CharacterDied = false
  210. SetupItem("Revolver")
  211. SetupItem("Knife")
  212. SetupItem("Radio")
  213. end
  214. end
  215. end
  216.  
  217. wait(2)
  218.  
  219. player.CharacterAdded:connect(function(char)
  220. local hum, t
  221. local start_wait = tick()
  222. while true do
  223. if tick() - start_wait > 3 then return end
  224. hum = char:FindFirstChild("Humanoid")
  225. t = char:FindFirstChild("Torso")
  226. if hum ~= nil and t ~= nil then
  227. break
  228. end
  229. wait()
  230. end
  231. if hum ~= nil and t ~= nil then
  232. if hum.Health > 0 then
  233. CurrentCharacter = char
  234. CurrentTorso = t
  235. CharacterDied = false
  236. SetupItem("Revolver")
  237. SetupItem("Knife")
  238. SetupItem("Radio")
  239. local con
  240. con = hum.Died:connect(function()
  241. CharacterDied = true
  242. con:Disconnect()
  243. end)
  244. end
  245. end
  246. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement