Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local ReplicatedStore = game.ReplicatedStorage
- local GameContent = ReplicatedStore:WaitForChild("GameContent")
- local RevolverContent = GameContent:WaitForChild("RevolverContent")
- local RevolverSkins = RevolverContent:WaitForChild("RevolverSkins")
- local KnifeContent = GameContent:WaitForChild("KnifeContent")
- local KnifeSkins = KnifeContent:WaitForChild("KnifeSkins")
- local RadioContent = GameContent:WaitForChild("RadioContent")
- local RadioSkins = RadioContent:WaitForChild("RadioSkins")
- local CurrRevolver = ""
- local CurrKnife = ""
- local CurrRadio = ""
- local rev_part, rev_mesh = nil, nil
- local knf_part, knf_mesh = nil, nil
- local rad_part, rad_mesh = nil, nil
- local SettingsOffset = {
- KnifeBack = CFrame.new(0, 0, 0.58) * CFrame.Angles(math.rad(-90), math.rad(-45), math.rad(-90)),
- KnifeLeft = CFrame.new(-0.55, 0.51, -0.13) * CFrame.Angles(math.rad(125), math.rad(180), math.rad(0)),
- KnifeScaleRatio = 1.2,
- RevolverRight = CFrame.new(0.5, 0.25, 0) * CFrame.Angles(math.rad(-25), 0, math.rad(180)),
- RadioBack = CFrame.new(0, 0, 1) * CFrame.Angles(0, math.rad(180), math.rad(45)),
- RevolverScaleRatio = 1.2,
- }
- local GetItemFromKeyHolder = function(KeyHolder, ItemName)
- for _, holder in pairs(KeyHolder:GetChildren()) do
- if holder.ClassName == "Model" then
- if holder.Name == ItemName then
- return holder
- end
- elseif holder.ClassName == "Folder" then
- for _, item in pairs(holder:GetChildren()) do
- if item.ClassName == "Model" then
- if item.Name == ItemName then
- return item
- end
- end
- end
- end
- end
- end
- function CreatePart()
- local npart = Instance.new("Part")
- npart.CanCollide = false
- npart.BrickColor = BrickColor.new("Really black")
- npart.formFactor = "Custom"
- npart.Size = Vector3.new(0.2, 0.2, 0.2)
- for _, surf_enum in pairs(Enum.NormalId:GetEnumItems()) do
- npart[surf_enum.Name .. "Surface"] = "SmoothNoOutlines"
- end
- return npart
- end
- local function GenItemObject(class_type, object_data)
- local npart = CreatePart()
- if object_data.Transparency then
- npart.Transparency = object_data.Transparency
- end
- local nmesh = Instance.new("SpecialMesh")
- nmesh.MeshType = "FileMesh"
- nmesh.MeshId = object_data.Mesh
- nmesh.TextureId = object_data.Texture
- nmesh.Parent = npart
- return npart, nmesh
- end
- local function GetChar()
- local g_char = player.Character
- if g_char ~= nil then
- local hum = g_char:FindFirstChild("Humanoid")
- local t = g_char:FindFirstChild("Torso")
- if hum ~= nil and t ~= nil then
- if hum.Health > 0 then
- return true, g_char, t, hum
- else
- return false, g_char, t, hum
- end
- end
- end
- return false, nil, nil, nil
- end
- local function GetItemData(Class)
- if Class == "Revolver" then
- local RevolverData = GetItemFromKeyHolder(RevolverSkins, CurrRevolver)
- if RevolverData ~= nil then
- local RevolverAppearance = RevolverData:WaitForChild("RevolverApp")
- return unpack(require(RevolverAppearance))
- end
- end
- if Class == "Knife" then
- local KnifeData = GetItemFromKeyHolder(KnifeSkins, CurrKnife)
- if KnifeData ~= nil then
- local KnifeAppearance = KnifeData:WaitForChild("KnifeApp")
- return unpack(require(KnifeAppearance))
- end
- end
- if Class == "Radio" then
- local RadioData = GetItemFromKeyHolder(RadioSkins, CurrRadio)
- if RadioData ~= nil then
- local RadioAppearance = RadioData:WaitForChild("RadioAppearance")
- return unpack(require(RadioAppearance))
- end
- end
- return nil
- end
- local function SetupItem(class_type)
- local item_data = GetItemData(class_type)
- local alive, char = GetChar()
- if (not alive) or (not item_data) then return end
- local Part, Mesh = GenItemObject(class_type, item_data)
- local new_w = Instance.new("Weld")
- new_w.Name = "RadioWeld"
- new_w.Part1 = Part
- Part.Parent = char
- local RadioEquipped = (CurrRadio ~= "" and CurrRadio ~= nil)
- if class_type == "Radio" then
- if rad_part then rad_part:Remove() end
- Mesh.Scale = item_data.RadioScale
- new_w.C0 = item_data.RadioOffset * SettingsOffset.RadioBack
- new_w.Part0 = char["Torso"]
- new_w.Parent = char["Torso"]
- local rad_part, rad_mesh = Part, Mesh
- elseif class_type == "Knife" then
- if knf_part then knf_part:Remove() end
- Mesh.Scale = item_data.WeaponScale * SettingsOffset.KnifeScaleRatio
- if RadioEquipped then
- new_w.Part0 = char["Left Leg"]
- new_w.Parent = char["Left Leg"]
- new_w.C0 = item_data.WeaponOffset * SettingsOffset.KnifeLeft
- else
- new_w.Part0 = char["Torso"]
- new_w.Parent = char["Torso"]
- new_w.C0 = item_data.WeaponOffset * SettingsOffset.KnifeBack
- end
- local knf_part, knf_mesh = Part, Mesh
- elseif class_type == "Revolver" then
- if rev_part then rev_part:Remove() end
- Mesh.Scale = item_data.WeaponScale * SettingsOffset.RevolverScaleRatio
- new_w.Part0 = char["Right Leg"]
- new_w.Parent = char["Right Leg"]
- new_w.C0 = item_data.WeaponOffset * SettingsOffset.RevolverRight
- local rev_part, rev_mesh = Part, Mesh
- end
- end
- local function UpdateSelections()
- local RadioName = "Default" --//GetFromClientData
- local KnifeName = "Default" --//GetFromClientData
- local RevolverName = "Default" --//GetFromClientData
- if not GetChar() then return end
- if CurrRadio ~= RadioName then
- CurrRadio = RadioName
- SetupItem("Radio")
- end
- if CurrRevolver ~= RevolverName then
- CurrRevolver = RevolverName
- SetupItem("Revolver")
- end
- if CurrKnife ~= KnifeName then
- CurrKnife = KnifeName
- SetupItem("Knife")
- end
- end
- --CLIENT_DATA.PlayerProfileChanged.Event:connect(UpdateSelections)
- UpdateSelections()
- local g_char = player.Character
- if g_char ~= nil then
- local hum = g_char:FindFirstChild("Humanoid")
- local t = g_char:FindFirstChild("Torso")
- if hum ~= nil and t ~= nil then
- if hum.Health > 0 then
- CurrentCharacter = g_char
- CurrentTorso = t
- CharacterDied = false
- SetupItem("Revolver")
- SetupItem("Knife")
- SetupItem("Radio")
- end
- end
- end
- wait(2)
- player.CharacterAdded:connect(function(char)
- local hum, t
- local start_wait = tick()
- while true do
- if tick() - start_wait > 3 then return end
- hum = char:FindFirstChild("Humanoid")
- t = char:FindFirstChild("Torso")
- if hum ~= nil and t ~= nil then
- break
- end
- wait()
- end
- if hum ~= nil and t ~= nil then
- if hum.Health > 0 then
- CurrentCharacter = char
- CurrentTorso = t
- CharacterDied = false
- SetupItem("Revolver")
- SetupItem("Knife")
- SetupItem("Radio")
- local con
- con = hum.Died:connect(function()
- CharacterDied = true
- con:Disconnect()
- end)
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement