enitre script for you
–[[
Scripted by LumberUniverse
]]
local Players = game:GetService(‘Players’)
local Workspace = game:GetService(‘Workspace’)
local TweenService = game:GetService(‘TweenService’)
local ReplicatedStorage = game:GetService(‘ReplicatedStorage’)
local StarterGui = game:GetService(‘StarterGui’)
local UserInputService = game:GetService(‘UserInputService’)
local HttpService = game:GetService(‘HttpService’)
local SoundService = game:GetService(‘SoundService’)
local RunService = game:GetService(‘RunService’)
local Debris = game:GetService(‘Debris’)
local LocalPlayer = Players.LocalPlayer
local Character = Workspace:WaitForChild(‘Character’):Clone()
local Spawn = Workspace:WaitForChild(‘Spawn’)
local SpawnPoint = Spawn:WaitForChild(‘HumanoidRootPart’)
local CameraPoint = Spawn:WaitForChild(‘Camera’)
local ShopCameraPoint = Spawn:WaitForChild(‘ShopCamera’)
local GunPoint = Spawn:WaitForChild(‘GunPoint’)
local Camera = Workspace.CurrentCamera
local Events = ReplicatedStorage:WaitForChild(‘Events’)
local GUI = script.Parent
local Content = GUI:WaitForChild(‘Content’)
local Buttons = Content:WaitForChild(‘Buttons’)
local LoadingScreen = GUI:WaitForChild(‘LoadingScreen’)
local LoadingContent = LoadingScreen:WaitForChild(‘Content’)
local LoadingCircle = LoadingContent.Bottom:WaitForChild(‘Circle’)
local LoadingInner = LoadingCircle:WaitForChild(‘Inner’)
local Event = Events:WaitForChild(‘Event’)
local Function = Events:WaitForChild(‘Function’)
local DUMMY = ReplicatedStorage:WaitForChild(‘Dummy’)
local SHOP = ReplicatedStorage:WaitForChild(‘Shop’)
local MODULES = ReplicatedStorage:WaitForChild(‘Modules’)
local OTHER_MODULE = require(MODULES:WaitForChild(‘Other’))
local LEVEL_MODULE = require(MODULES:WaitForChild(‘LevelModule’))
local REWARDS = require(MODULES:WaitForChild(‘LevelModule’):WaitForChild(‘Rewards’))
local OUTFITS = SHOP:WaitForChild(‘Outfits’):GetChildren()
local WEAPONS = SHOP:WaitForChild(‘Weapons’):GetChildren()
local SKINS = OTHER_MODULE.Skins
local track
local CHARACTER_LOADED = false
Character.Parent = Workspace
Character.Name = ‘Character_’ … LocalPlayer.Name
coroutine.wrap(function()
Character:WaitForChild(‘Humanoid’):ApplyDescription(Players:GetHumanoidDescriptionFromUserId(LocalPlayer.CharacterAppearanceId), Enum.AssetTypeVerification.ClientOnly)
CHARACTER_LOADED = true
end)()
local TWEEN_INFO = TweenInfo.new(0.5)
local COST_TEXT = ‘Cost: $%i’
local DESC_TEXT = ‘Desc/Stats: %s’
local CALLBACKS = {
Spawn = function()
local response = Function:InvokeServer({
type = ‘SPAWN’
})
if not response then
SoundService:WaitForChild('Error'):Play()
end
end,
Shop = function()
Content.GunRotate.Visible = true
Tween(Workspace.CurrentCamera, {
CFrame = ShopCameraPoint.CFrame
})
end
}
local OLD_POSITIONS = {
[‘Coins’] = Content.Shop.Content.Coins.Position,
[‘Outfits’] = Content.Shop.Content.Outfits.Position,
[‘Skins’] = Content.Shop.Content.Skins.Position,
[‘Weapons’] = Content.Shop.Content.Weapons.Position,
}
local STAT_NAMES = {
[‘Damage’] = ‘BaseDamage’,
[‘Recoil’] = ‘Recoil’,
[‘MagCapacity’] = ‘AmmoPerMag’,
[‘ReloadTime’] = ‘ReloadTime’,
}
local FOLDERS = {
[‘Weapons’] = WEAPONS,
[‘Outfits’] = OUTFITS,
[‘Skins’] = SKINS
}
local FUNCTIONS = {
[‘Weapons’] = function(parent, gun)
FocusGun(parent, gun)
end,
['Outfits'] = function(parent, selection, typ)
FocusOther(parent, selection, typ)
end,
['Skins'] = function(parent, selection, typ)
FocusOther(parent, selection, typ)
end,
}
local MAX_STATS = {
}
local TEAMS = {
‘Red’,
‘Blue’
}
function Tween(instance, properties, style)
local tween = TweenService:Create(
instance,
style or TWEEN_INFO,
properties
)
tween:Play()
return tween
end
local function AddAccessory(char, accessory)
local attachment = accessory.Handle:FindFirstChildOfClass(‘Attachment’)
local weld = Instance.new(‘Weld’)
weld.Name = ‘AccessoryWeld’
weld.Part0 = accessory.Handle
if attachment then
local other = char:FindFirstChild(tostring(attachment), true)
weld.C0 = attachment.CFrame
weld.C1 = other.CFrame
weld.Part1 = other.Parent
else
weld.C1 = CFrame.new(0, char.Head.Size.Y / 2, 0) * accessory.AttachmentPoint:inverse()
weld.Part1 = char.Head
end
accessory.Handle.CFrame = weld.Part1.CFrame * weld.C1 * weld.C0:inverse()
accessory.Parent = char
weld.Parent = accessory.Handle
end
local function GetSkin(item)
for i, skin in pairs(OTHER_MODULE.Skins)do
if skin.Name == item then
return skin
end
end
end
local function WeldWeapon(Weapon, Character)
local Accessory = Instance.new(‘Accessory’)
Accessory.Name = ‘Weapon’
for i, part in pairs(Weapon:GetChildren())do
part.Parent = Accessory
end
AddAccessory(Character, Accessory)
end
local function MoveCharacter()
local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local humanoid = character:WaitForChild(‘Humanoid’)
local hum = Character:WaitForChild(‘Humanoid’)
if character and humanoid and not LocalPlayer:GetAttribute(‘SPAWNED’) then
local weapon = WEAPONS[1]:Clone()
for i, descendant in pairs(weapon:GetDescendants())do
if descendant:IsA('Script') then
descendant:Destroy()
end
end
hum:EquipTool(weapon)
WeldWeapon(weapon, Character)
track = hum:LoadAnimation(script.Animation)
track:Play()
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
Character:SetPrimaryPartCFrame(SpawnPoint.CFrame)
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = CameraPoint.CFrame
end
end
local function SpinLoad(t)
local amount = ‘’
local count = 0
repeat
count += 1
if amount:len() >= 3 then
amount = ''
else
amount ..= '.'
end
LoadingContent.Bottom.TextLabel.Text = 'Loading' .. amount
Tween(LoadingInner, {
Rotation = LoadingInner.Rotation + 180
}, TweenInfo.new(0.5, Enum.EasingStyle.Linear))
wait(0.5)
until count >= t*2 and CHARACTER_LOADED
end
local function Check(child, t)
if child:IsA(‘GuiButton’) or child:IsA(‘Frame’) then
Tween(child, {
Transparency = t
})
elseif child:IsA(‘TextLabel’) then
Tween(child, {
Transparency = t,
TextTransparency = t,
TextStrokeTransparency = t
})
elseif child:IsA(‘ImageLabel’) then
Tween(child, {
ImageTransparency = t
})
end
end
local function Trans(parent, t)
Check(parent, t)
for i, child in pairs(parent:GetDescendants())do
Check(child, t)
end
end
local function InitMaxStats()
for i, weapon in pairs(WEAPONS)do
if weapon:FindFirstChild(‘Setting’) and weapon:GetAttribute(‘isInShop’) ~= false then
local module = require(weapon:FindFirstChild(‘Setting’))
for i, stat in pairs(STAT_NAMES)do
MAX_STATS[stat] = (not MAX_STATS[stat] and module[stat]) or (module[stat] > MAX_STATS[stat] and module[stat]) or MAX_STATS[stat]
end
end
end
end
local function FindFromChildren(children, name)
for i, child in pairs(children)do
if child.Name == name then
return child
end
end
end
local function AnchorModel(model)
for i, descendant in pairs(model:GetDescendants())do
if descendant:IsA(‘BasePart’) then
descendant.Anchored = true
end
end
end
– CORE FUNCTIONS
local function ClearAccessories(char)
for i, object in pairs(char:GetChildren())do
if object:IsA(‘Accessory’) then
object:Destroy()
end
end
end
local function AddOutfitToDummy(dummy, outfit)
ClearAccessories(dummy)
if outfit:FindFirstChild('Accessories') then
for i, Accessory in pairs(outfit.Accessories:GetChildren())do
local clone = Accessory:Clone()
--dummy:FindFirstChildOfClass('Humanoid'):AddAccessory(clone)
AddAccessory(dummy, clone)
end
end
if outfit:FindFirstChild('Other') then
for i, instance in pairs(outfit.Other:GetChildren())do
local clone = dummy:FindFirstChild(instance.Name) or Instance.new(instance.Name)
clone.Parent = dummy
clone.Name = instance.Name
clone[instance.Name .. 'Template'] = instance.Value
end
end
end
local function LevelBar()
if not LocalPlayer:GetAttribute(‘Data’) then return end
local data = HttpService:JSONDecode(LocalPlayer:GetAttribute('Data'))
Content.Level.Bar.Exp.Text = string.format('%i/%i', data.Experience, LEVEL_MODULE.GetXP(data.Level + 1))
Content.Level.Bar.Current.Text = data.Level
Content.Level.Bar.Next.Text = data.Level + 1
Content.Level.Bar.Bar.Visible = data.Experience > 0
Content.Level.Bar.Bar:TweenSize(UDim2.new(math.clamp(data.Experience / LEVEL_MODULE.GetXP(data.Level + 1), 0, 1), 0, 1, 0), 'Out', 'Quad', 0.5, true)
for i, child in pairs(Content.Level.Rewards:GetChildren())do
if child:IsA('Frame') then
child:Destroy()
end
end
if REWARDS[data.Level] then
for i, reward in pairs(REWARDS[data.Level])do
local clone = script.Reward:Clone()
clone.Parent = Content.Level.Rewards
clone.TextLabel.Text = '+' .. ((reward.Type == 'Coins' and reward.Amount) or reward.SkinName)
clone.ImageLabel.Image = (reward.Type == 'Coins' and 'rbxassetid://6392085232') or (GetSkin(reward.SkinName) and GetSkin(reward.SkinName).Texture)
end
end
end
local function LoadData()
repeat
RunService.RenderStepped:Wait()
until LocalPlayer:GetAttribute(‘Data’)
local data = HttpService:JSONDecode(LocalPlayer:GetAttribute('Data'))
local inventories = data.Inventories
local typ = script:GetAttribute('Type')
local openedGui = script:GetAttribute('OpenedGui')
local openGui = Content:FindFirstChild(openedGui or 'Shop')
for name, inventory in pairs(inventories)do
local parent = Content.Inventory.Content:FindFirstChild(name)
if parent then
for i, item in pairs(inventory) do
local clone = parent:FindFirstChild(item) or (script:FindFirstChild(name) or script.Weapon):Clone()
clone.Parent = parent
clone.Name = item
clone.TextLabel.Text = item
if name == 'Weapons' then
local wclone = SHOP:WaitForChild('Weapons'):FindFirstChild(item):Clone()
for i, descendant in pairs(wclone:GetDescendants())do
if descendant:IsA('Script') then
descendant:Destroy()
end
end
wclone.Parent = clone.ViewportFrame
local model = wclone:FindFirstChildOfClass('Model') or wclone
local distance = ((model.CamPoint.Size.Z * (clone.ViewportFrame.AbsoluteSize.X/clone.ViewportFrame.AbsoluteSize.Y))/2) / math.tan(math.rad(35))
local cam = Instance.new('Camera')
cam.Parent = clone.ViewportFrame
cam.CFrame = CFrame.new((model.CamPoint.CFrame * CFrame.new(-distance, 0, 0)).Position, model.CamPoint.Position)
clone.ViewportFrame.CurrentCamera = cam
elseif name == 'Outfits' then
local dummy = DUMMY:Clone()
dummy.Parent = clone.ViewportFrame
dummy.PrimaryPart.Anchored = true
local cam = Instance.new('Camera')
cam.Parent = clone.ViewportFrame
cam.CFrame = CFrame.new((dummy.PrimaryPart.CFrame * CFrame.new(0, 0, -4.25)).Position, dummy.PrimaryPart.Position)
clone.ViewportFrame.CurrentCamera = cam
AddOutfitToDummy(dummy, SHOP:WaitForChild('Outfits'):FindFirstChild(item))
elseif name == 'Skins' then
clone.ImageLabel.Image = GetSkin(item).Texture
end
clone.MouseButton1Click:Connect(function()
Content.Inventory.Right.Visible = true
if name == 'Weapons' then
FocusGun(Content.Inventory, SHOP:WaitForChild('Weapons'):FindFirstChild(item))
elseif name == 'Outfits' then
FocusOther(Content.Inventory, SHOP:WaitForChild('Outfits'):FindFirstChild(item), name)
elseif name == 'Skins' then
FocusOther(Content.Inventory, GetSkin(item), name)
end
end)
end
end
end
if typ == 'Weapons' then
FocusGun(openGui, FindFromChildren(WEAPONS, openGui.Content:FindFirstChild(typ):GetAttribute('Selected')))
else
FocusOther(openGui, FindFromChildren(FOLDERS[typ], openGui.Content:FindFirstChild(typ):GetAttribute('Selected')), typ)
end
GUI.Content.HotBar.Body.Primary.Left.TextLabel.Text = data.Equipped['Weapons']:upper()
LevelBar()
end
local function ConnectSounds(btn)
if btn:IsA(‘GuiButton’) then
btn.MouseEnter:Connect(function()
script.Hover:Play()
end)
btn.MouseButton1Click:Connect(function()
script.Click:Play()
end)
end
end
local function updateHealth(humanoid)
local gameplay = GUI.Gameplay
local hp = humanoid.Health
local maxHp = humanoid.MaxHealth
local percentage = math.clamp(hp/maxHp, 0, 1)
gameplay.Health.Bar.Bar:TweenSize(UDim2.new(percentage, 0, 1, 0), 'Out', 'Quad', 0.5, true)
gameplay.Health.Bar.Bar.BackgroundColor3 = Color3.fromRGB(255, 0, 4):lerp(Color3.fromRGB(69, 255, 49), percentage)
gameplay.Health.Bar.Bar.Right.ImageColor3 = Color3.fromRGB(255, 0, 4):lerp(Color3.fromRGB(69, 255, 49), percentage)
gameplay.Health.Bar.Current.Text = hp
end
function FocusGun(parent, gun)
if not LocalPlayer:GetAttribute(‘Data’) then return end
local Config = gun:FindFirstChildOfClass('Configuration')
local data = HttpService:JSONDecode(LocalPlayer:GetAttribute('Data'))
Spawn:WaitForChild('FocusedGun'):ClearAllChildren()
local clone = gun:FindFirstChildOfClass('Model'):Clone()
clone.Parent = Spawn:WaitForChild('FocusedGun')
clone:SetPrimaryPartCFrame(GunPoint.CFrame)
if clone.Name == 'Uzi' then
AnchorModel(clone)
else
clone.PrimaryPart.Anchored = true
end
GunPoint:SetAttribute('Rotation', Vector2.new(0, 0))
parent.Right.Content.Weapons.Weapon.Text = gun.Name
parent.Right.Content.Weapons.Cost.Text = string.format(COST_TEXT, Config.Price.Value)
parent.Right.Content.Weapons.Description.Text = string.format(DESC_TEXT, '')
if parent.Name == 'Inventory' then
parent.Right:FindFirstChildOfClass('TextButton').TextLabel.Text = (gun.Name == data.Equipped['Weapons'] and 'EQUIPPED') or 'EQUIP'
else
parent.Right:FindFirstChildOfClass('TextButton').TextLabel.Text = ((data.Inventories['Weapons'] and table.find(data.Inventories['Weapons'], gun.Name)) and 'OWNED') or 'PURCHASE'
end
parent.Content.Weapons:SetAttribute('Selected', gun.Name)
script:SetAttribute('Type', 'Weapons')
for i, button in pairs(parent.Content.Weapons:GetChildren())do
if button:IsA('GuiButton') then
button.BorderSizePixel = (gun.Name == button.Name and 1) or 0
button.Hue.BackgroundColor3 = (gun.Name == button.Name and Color3.fromRGB(85, 255, 127)) or Color3.fromRGB(255, 255, 255)
end
end
if gun:FindFirstChild('Setting') then
local module = require(gun:FindFirstChild('Setting'))
for i, stat in pairs(parent.Right.Content.Weapons:GetChildren())do
if STAT_NAMES[stat.Name] then
stat.Bar.Bar.Size = UDim2.new(module[STAT_NAMES[stat.Name]]/MAX_STATS[STAT_NAMES[stat.Name]], 0, 1, 0)
end
end
end
end
function FocusOther(parent, selection, typ)
local Config = (type(selection) == ‘table’ and selection) or selection:FindFirstChildOfClass(‘Configuration’)
local data = HttpService:JSONDecode(LocalPlayer:GetAttribute(‘Data’))
parent.Right.Content:FindFirstChild(typ).Item.Text = selection.Name
parent.Right.Content:FindFirstChild(typ).Cost.Text = string.format(COST_TEXT, (type(Config) == 'table' and Config.Price) or Config.Price.Value)
parent.Right.Content:FindFirstChild(typ).Description.Text = string.format(DESC_TEXT, '')
parent.Right:FindFirstChildOfClass('TextButton').TextLabel.Text = (selection.Name == data.Equipped[typ] and 'EQUIPPED') or 'EQUIP'
if parent.Name == 'Inventory' then
parent.Right:FindFirstChildOfClass('TextButton').TextLabel.Text = (selection.Name == data.Equipped[typ] and 'EQUIPPED') or 'EQUIP'
else
parent.Right:FindFirstChildOfClass('TextButton').TextLabel.Text = ((data.Inventories[typ] and table.find(data.Inventories[typ], selection.Name)) and 'OWNED') or 'PURCHASE'
end
parent.Content:FindFirstChild(typ):SetAttribute('Selected', selection.Name)
script:SetAttribute('Type', typ)
for i, button in pairs(parent.Content:FindFirstChild(typ):GetChildren())do
if button:IsA('GuiButton') then
button.BorderSizePixel = (selection.Name == button.Name and 1) or 0
button.Hue.BackgroundColor3 = (selection.Name == button.Name and Color3.fromRGB(85, 255, 127)) or Color3.fromRGB(255, 255, 255)
end
end
end
local function characterAdded(character)
local humanoid
repeat
RunService.RenderStepped:Wait()
humanoid = character:FindFirstChildOfClass('Humanoid')
until humanoid
updateHealth(humanoid)
humanoid:GetPropertyChangedSignal('MaxHealth'):Connect(function()
GUI.Gameplay.Health.Bar.Max.Text = humanoid.MaxHealth
end)
humanoid.HealthChanged:Connect(function()
updateHealth(humanoid)
end)
end
local function createVoteButton(map, votes)
local frame = script.VotingTemplate:Clone()
frame.Name = map
frame.Parent = GUI.Voting
frame.MapName.Text = map:upper()
frame.MouseButton1Click:Connect(function()
Event:FireServer({
type = 'VOTE_OPTION',
payload = {
option = map
}
})
end)
return frame
end
–= INITIALISE =–
– MENU BUTTONS
coroutine.wrap(function()
for i, button in pairs(Buttons:GetChildren())do
if button:IsA(‘TextButton’) then
button.MouseButton1Click:Connect(function()
if CALLBACKS[button.Name] then
CALLBACKSbutton.Name
end
if Content:FindFirstChild(button.Name) then
Buttons:TweenPosition(UDim2.new(-0.2, -10, 0.5, 0), 'Out', 'Quad', 0.5, true)
Tween(Content:FindFirstChild(button.Name), {
AnchorPoint = Vector2.new(0, 0.5)
})
Content:FindFirstChild(button.Name):TweenPosition(UDim2.new(0, 0, 0.475, 0), 'Out', 'Quad', 0.5, true)
script:SetAttribute('OpenedGui', button.Name)
end
end)
end
end
end)()
– MENU BACK BUTTONS
Content.Inventory.Bottom.TextButton.MouseButton1Click:Connect(function()
Buttons:TweenPosition(UDim2.new(0, 0, 0.5, 0), ‘Out’, ‘Quad’, 0.5, true)
Tween(Content.Inventory, {
AnchorPoint = Vector2.new(1, 0.5)
})
Content.Inventory:TweenPosition(UDim2.new(-0.25, -10, 0.475, 0), ‘Out’, ‘Quad’, 0.5, true)
end)
Content.Shop.Bottom.TextButton.MouseButton1Click:Connect(function()
Buttons:TweenPosition(UDim2.new(0, 0, 0.5, 0), ‘Out’, ‘Quad’, 0.5, true)
Tween(Content.Shop, {
AnchorPoint = Vector2.new(1, 0.5)
})
Content.Shop:TweenPosition(UDim2.new(-0.25, -10, 0.475, 0), ‘Out’, ‘Quad’, 0.5, true)
Content.GunRotate.Visible = false
Tween(Workspace.CurrentCamera, {
CFrame = CameraPoint.CFrame
})
end)
– INVENTORY
coroutine.wrap(function()
for i, button in pairs(Content.Inventory.Top:GetChildren())do
if button:IsA(‘TextButton’) then
button.MouseButton1Click:Connect(function()
for i, btn in pairs(Content.Inventory.Top:GetChildren())do
if btn:IsA(‘TextButton’) then
Tween(btn.ImageLabel, {
ImageTransparency = (btn == button and 0) or 0.5
})
end
end
for i, menu in pairs(Content.Inventory.Content:GetChildren())do
if menu:IsA('ScrollingFrame') then
menu:TweenPosition(UDim2.new(OLD_POSITIONS[menu.Name].X.Scale - button.LayoutOrder, OLD_POSITIONS[menu.Name].X.Offset - button.LayoutOrder * 10, 0, 0), 'Out', 'Quad', 0.5, true)
end
end
if FOLDERS[button.Name] then
local btn = Content.Inventory.Content:FindFirstChild(button.Name):FindFirstChildOfClass('TextButton')
if btn then
Content.Inventory.Right.Visible = true
FUNCTIONS[button.Name](Content.Inventory, FindFromChildren(FOLDERS[button.Name], Content.Inventory.Content:FindFirstChild(button.Name):GetAttribute('Selected') or btn.Name), button.Name)
else
Content.Inventory.Right.Visible = false
end
for i, menu in pairs(Content.Inventory.Right.Content:GetChildren())do
menu:TweenPosition(UDim2.new(OLD_POSITIONS[menu.Name].X.Scale - button.LayoutOrder, OLD_POSITIONS[menu.Name].X.Offset - button.LayoutOrder * 10, 0, 0), 'Out', 'Quad', 0.5, true)
end
end
end)
end
end
end)()
– SHOP
coroutine.wrap(function()
for i, button in pairs(Content.Shop.Top:GetChildren())do
if button:IsA(‘TextButton’) then
button.MouseButton1Click:Connect(function()
for i, btn in pairs(Content.Shop.Top:GetChildren())do
if btn:IsA(‘TextButton’) then
Tween(btn.ImageLabel, {
ImageTransparency = (btn == button and 0) or 0.5
})
end
end
for i, menu in pairs(Content.Shop.Content:GetChildren())do
if menu:IsA('ScrollingFrame') then
menu:TweenPosition(UDim2.new(OLD_POSITIONS[menu.Name].X.Scale - button.LayoutOrder, OLD_POSITIONS[menu.Name].X.Offset - button.LayoutOrder * 10, 0, 0), 'Out', 'Quad', 0.5, true)
end
end
if FOLDERS[button.Name] then
FUNCTIONS[button.Name](Content.Shop, FindFromChildren(FOLDERS[button.Name], Content.Shop.Content:FindFirstChild(button.Name):GetAttribute('Selected')) or FOLDERS[button.Name][1], button.Name)
for i, menu in pairs(Content.Shop.Right.Content:GetChildren())do
menu:TweenPosition(UDim2.new(OLD_POSITIONS[menu.Name].X.Scale - button.LayoutOrder, OLD_POSITIONS[menu.Name].X.Offset - button.LayoutOrder * 10, 0, 0), 'Out', 'Quad', 0.5, true)
end
end
end)
end
end
end)()
Content.Shop.Right.Purchase.MouseButton1Click:Connect(function()
Event:FireServer({
type = ‘SHOP_PURCHASE’,
payload = {
type = script:GetAttribute(‘Type’),
item = Content.Shop.Content:FindFirstChild(script:GetAttribute(‘Type’)):GetAttribute(‘Selected’)
}
})
end)
Content.Inventory.Right.Equip.MouseButton1Click:Connect(function()
Event:FireServer({
type = ‘INVENTORY_EQUIP’,
payload = {
type = script:GetAttribute(‘Type’),
item = Content.Inventory.Content:FindFirstChild(script:GetAttribute(‘Type’)):GetAttribute(‘Selected’)
}
})
end)
– ADD OUTFITS
coroutine.wrap(function()
for i, outfit in pairs(OUTFITS)do
local clone = script.Outfit:Clone()
clone.Parent = Content.Shop.Content.Outfits
clone.TextLabel.Text = outfit.Name
clone.Name = outfit.Name
local dummy = DUMMY:Clone()
dummy.Parent = clone.ViewportFrame
dummy.PrimaryPart.Anchored = true
local cam = Instance.new('Camera')
cam.Parent = clone.ViewportFrame
cam.CFrame = CFrame.new((dummy.PrimaryPart.CFrame * CFrame.new(0, 0, -4.25)).Position, dummy.PrimaryPart.Position)
clone.ViewportFrame.CurrentCamera = cam
clone.MouseButton1Click:Connect(function()
FocusOther(Content.Shop, outfit, 'Outfits')
end)
AddOutfitToDummy(dummy, outfit)
end
end)()
– ADD WEAPONS
coroutine.wrap(function()
for i, weapon in pairs(WEAPONS)do
if weapon:GetAttribute(‘isInShop’) == false then continue end
local clone = script.Weapon:Clone()
clone.Parent = Content.Shop.Content.Weapons
clone.TextLabel.Text = weapon.Name
clone.Name = weapon.Name
local wclone = weapon:Clone()
for i, descendant in pairs(wclone:GetDescendants())do
if descendant:IsA('Script') then
descendant:Destroy()
end
end
wclone.Parent = clone.ViewportFrame
local model = wclone:FindFirstChildOfClass('Model') or wclone
local distance = ((model.CamPoint.Size.Z * (clone.ViewportFrame.AbsoluteSize.X/clone.ViewportFrame.AbsoluteSize.Y))/2) / math.tan(math.rad(35))
local cam = Instance.new('Camera')
cam.Parent = clone.ViewportFrame
cam.CFrame = CFrame.new((model.CamPoint.CFrame * CFrame.new(-distance, 0, 0)).Position, model.CamPoint.Position)
clone.ViewportFrame.CurrentCamera = cam
clone.MouseButton1Click:Connect(function()
FocusGun(Content.Shop, weapon)
end)
end
end)()
– ADD SKINS
coroutine.wrap(function()
for i, tab in pairs(SKINS)do
local clone = script.Skins:Clone()
clone.Parent = Content.Shop.Content.Skins
clone.TextLabel.Text = tab.Name
clone.Name = tab.Name
clone.ImageLabel.Image = tab.Texture
clone.MouseButton1Click:Connect(function()
FocusOther(Content.Shop, tab, 'Skins')
end)
end
end)()
–= MISC =–
LocalPlayer:GetAttributeChangedSignal(‘Data’):Connect(function()
LoadData()
end)
local previous = Vector2.new(LocalPlayer:GetMouse().X, LocalPlayer:GetMouse().Y)
GunPoint:GetAttributeChangedSignal(‘Rotation’):Connect(function()
if Spawn:WaitForChild(‘FocusedGun’):FindFirstChildOfClass(‘Model’) then
local vctr2 = GunPoint:GetAttribute(‘Rotation’)
Spawn:WaitForChild(‘FocusedGun’):FindFirstChildOfClass(‘Model’):SetPrimaryPartCFrame(GunPoint.CFrame * CFrame.Angles(0, math.deg(vctr2.X), math.deg(vctr2.Y)))
end
end)
LocalPlayer:GetAttributeChangedSignal(‘SPAWNED’):Connect(function()
TweenService:Create(
SoundService:FindFirstChild(‘LobbyMusic’),
TweenInfo.new(1),
{
Volume = (LocalPlayer:GetAttribute(‘SPAWNED’) and 0) or 0.5
}
):Play()
if not LocalPlayer:GetAttribute('SPAWNED') then
GUI.Content.Visible = true
MoveCharacter()
elseif LocalPlayer.Character then
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
GUI.Content.Visible = false
if LocalPlayer.Character and LocalPlayer.Character.PrimaryPart then
LocalPlayer.Character.PrimaryPart.Anchored = false
end
Workspace.CurrentCamera.CameraSubject = LocalPlayer.Character:FindFirstChildOfClass('Humanoid')
end
GUI.Gameplay.Visible = not GUI.Content.Visible
end)
Content.GunRotate.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton2 then
previous = Vector2.new(input.Position.X, input.Position.Y)
script:SetAttribute('RightDown', true)
end
end)
LocalPlayer.CharacterAdded:Connect(characterAdded)
if LocalPlayer.Character then
characterAdded(LocalPlayer.Character)
end
UserInputService.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton2 then
script:SetAttribute(‘RightDown’, false)
end
end)
UserInputService.InputChanged:Connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.MouseMovement and script:GetAttribute(‘RightDown’) then
local delta = (previous - Vector2.new(input.Position.X, input.Position.Y))
GunPoint:SetAttribute(‘Rotation’, GunPoint:GetAttribute(‘Rotation’) + Vector2.new(-delta.X/5000, delta.Y/5000))
previous = Vector2.new(input.Position.X, input.Position.Y)
end
end)
Event.OnClientEvent:Connect(function(action)
if action.type == ‘PLAY_SOUND’ and action.payload and action.payload.sound then
action.payload.sound:Play()
elseif action.type == ‘SET_WALKSPEED’ and action.payload and action.payload.speed and LocalPlayer.Character then
LocalPlayer.Character:FindFirstChildOfClass(‘Humanoid’).WalkSpeed = action.payload.speed
elseif action.type == ‘SET_JUMPPOWER’ and action.payload and action.payload.power and LocalPlayer.Character then
LocalPlayer.Character:FindFirstChildOfClass(‘Humanoid’).JumpPower = action.payload.power
elseif action.type == ‘UPDATE_TOP_STATS’ and action.payload and action.payload.players then
GUI.Other.Top.Players.Visible = action.payload.Active
action.payload.players = (not action.payload.player and action.payload.players) or {action.payload.players}
if not action.payload.Active then
local children = GUI.Other.Top.Players:GetChildren()
for i=1, #children do
if not children[i]:IsA('UIPadding') then
children[i]:Destroy()
end
end
end
for i=1, #action.payload.players do
local player = action.payload.players[i]
local clone = GUI.Other.Top.Players:FindFirstChild(player.UserId) or script.Player:Clone()
clone.Name = player.UserId
clone.Parent = GUI.Other.Top.Players
clone.Thumbnail.Image = string.format('rbxthumb://type=AvatarHeadShot&id=%i&w=420&h=420', player.UserId)
clone.Amount.Text = player.Kills
clone.LayoutOrder = -player.Kills
end
elseif action.type == 'KILL_FEED' then
local killfeed = script.Killfeed:Clone()
killfeed.Parent = GUI.Killfeed
killfeed.Victim.Text = action.payload.victim
killfeed.Killer.Text = action.payload.killer
killfeed.LayoutOrder = -os.clock()
Debris:AddItem(killfeed, 5)
elseif action.type == 'VOTING_UPDATE' then
GUI.Voting.Visible = not action.payload.disabled
for map, votes in pairs(action.payload.info.votes)do
local frame = GUI.Voting:FindFirstChild(map) or createVoteButton(map, votes)
frame.Votes.Text = #votes
end
for i, frame in pairs(GUI.Voting:GetChildren())do
if not action.payload.info.votes[frame.Name] and frame:IsA('TextButton') then
frame:Destroy()
end
end
end
end)
ReplicatedStorage:GetAttributeChangedSignal(‘USER_TEXT’):Connect(function()
GUI.Other.Top.TextLabel.Text = ReplicatedStorage:GetAttribute(‘USER_TEXT’)
end)
ReplicatedStorage:GetAttributeChangedSignal(‘KoTH’):Connect(function()
GUI.Other.Timers.Visible = ReplicatedStorage:GetAttribute(‘KoTH’)
end)
ReplicatedStorage:GetAttributeChangedSignal(‘TryingToCapture’):Connect(function()
local team = ReplicatedStorage:GetAttribute(‘TryingToCapture’)
local timer = GUI.Other.Timers:FindFirstChild(team)
GUI.Other.Capture.Visible = team ~= ''
GUI.Other.Capture.Team.Text = team:upper()
for i, child in pairs({GUI.Other.Capture.Bar, unpack(GUI.Other.Capture.Bar:GetChildren())})do
if child:IsA('Frame') then
child.BackgroundColor3 = (timer and timer.BackgroundColor3) or Color3.fromRGB(255, 255, 255)
elseif child:IsA('ImageLabel') then
child.ImageColor3 = (timer and timer.BackgroundColor3) or Color3.fromRGB(255, 255, 255)
end
end
end)
ReplicatedStorage:GetAttributeChangedSignal(‘CapturePercentage’):Connect(function()
local percent = ReplicatedStorage:GetAttribute(‘CapturePercentage’)
GUI.Other.Capture.Bar:TweenSize(UDim2.new(math.clamp(percent, 0, 1), 0, 1, 0), ‘Out’, ‘Quad’, 0.5, true)
end)
for i, team in pairs(TEAMS)do
ReplicatedStorage:GetAttributeChangedSignal(team … ‘Timer’):Connect(function()
local max = ReplicatedStorage:GetAttribute(‘TimerMax’)
local value = math.clamp(ReplicatedStorage:GetAttribute(team … ‘Timer’), 0, max)
GUI.Other.Timers:FindFirstChild(team).Clock.Text = value
GUI.Other.Timers:FindFirstChild(team).Percent:TweenSize(UDim2.new(math.clamp(value/max, 0, 1), 0, 1, 0), ‘Out’, ‘Quad’, 0.5, true)
end)
ReplicatedStorage:GetAttributeChangedSignal(team .. '_SPAWN_TIME'):Connect(function()
local max = ReplicatedStorage:GetAttribute(team .. '_MAX_SPAWN_TIME')
local value = math.clamp(ReplicatedStorage:GetAttribute(team .. '_SPAWN_TIME') or max, 0, max)
local teamFrame = GUI.Other.Timers:FindFirstChild(team).SpawnTimer
teamFrame.Clock.Text = string.format('SPAWNING IN %is', value)
teamFrame.Percent:TweenSize(UDim2.new(math.clamp(value/max, 0, 1), 0, 1, 0), 'Out', 'Quad', 0.5, true)
end)
end
for i, btn in pairs(GUI:GetDescendants())do
if btn.Name ~= ‘GunRotate’ then
ConnectSounds(btn)
end
end
GUI.DescendantAdded:Connect(function(btn)
ConnectSounds(btn)
end)
GUI.Voting.UIListLayout:GetPropertyChangedSignal(‘AbsoluteContentSize’):Connect(function()
local abs = GUI.Voting.UIListLayout.AbsoluteContentSize
GUI.Voting.Size = UDim2.new(0, abs.X + ((#GUI.Voting:GetChildren() - 3) * 5), 0.15, 0)
end)
Event:FireServer({
type = ‘GET_VOTING’
})
InitMaxStats()
MoveCharacter()
FocusGun(Content.Shop, WEAPONS[1])
LoadData()
LoadingScreen.Visible = true
wait(2.5)
SpinLoad(10)
Trans(LoadingScreen, 1)