Gun Shop Local Script:
local frame = script.Parent.Main
local GunList = frame:WaitForChild("GunList")
local VerificationFrame = frame:WaitForChild("VerificationFrame")
local VestsList = frame:WaitForChild("VestLists")
local G17 = GunList:WaitForChild("G17")
local TEC = GunList:WaitForChild("TEC-9")
local P_90 = GunList:WaitForChild("P-90")
local AK = GunList:WaitForChild("AK-47")
local AR = GunList:WaitForChild("AR")
local GunEvents = game:FindFirstChildWhichIsA("ReplicatedStorage"):WaitForChild("GunEvents")
local G = GunEvents:WaitForChild("G")
local A = GunEvents:WaitForChild("A")
local AS = GunEvents:WaitForChild("AS")
local P = GunEvents:WaitForChild("P")
local T = GunEvents:WaitForChild("T")
local Light = VestsList:WaitForChild("Light")
local Med = VestsList:WaitForChild("Medium")
local Heavy = VestsList:WaitForChild("Heavy")
local YES = VerificationFrame:WaitForChild("YES")
local NO = VerificationFrame:WaitForChild("NO")
local VerificationTitle = VerificationFrame:WaitForChild("VerifyTitle")
local VerifyString = "ARE YOU SURE YOU WANT TO BUY A: "
local ResetString = " YOU WILL BE RESETTED AFTER BUYING THIS WEAPON, IN ORDER TO RECEIVE IT."
local player = game:FindFirstChildWhichIsA("Players").LocalPlayer or game:FindFirstChildWhichIsA("Players").Players.PlayerAdded:Wait()
local currency = player:WaitForChild("Currency")
local WeaponBoolean = {
G17SELECTED = false,
TECSELECTED = false,
AKSELECTED = false,
P90SELECTED = false,
ARSELECTED = false
}
local LIGHTSELECTED = false
local MEDSELECTED = false
local HEAVYSELECTED = false
local ServerStorage = game:FindFirstChildWhichIsA("ReplicatedStorage")
for _, bool in pairs(WeaponBoolean) do
G17.MouseButton1Click:Connect(function()
bool = false
WeaponBoolean.G17SELECTED = true
VerificationFrame.Visible = true
VerificationTitle.Text = VerifyString.. "GLOCK-17?".. ResetString
YES.MouseButton1Click:Connect(function()
if WeaponBoolean.G17SELECTED and not player:WaitForChild("Backpack"):FindFirstChild("GLOCK17") and player:WaitForChild("Leaderstats"):WaitForChild("Level").Value >= 15 and currency.Value >= 220 then
G:FireServer()
wait()
WeaponBoolean.G17SELECTED = false
VerificationFrame.Visible = false
end
if player:WaitForChild("Backpack"):FindFirstChild("GLOCK17") then
VerificationFrame.Visible = false
end
end)
NO.MouseButton1Click:Connect(function()
VerificationFrame.Visible = false
end)
end)
TEC.MouseButton1Click:Connect(function()
bool = false
WeaponBoolean.TECSELECTED = true
VerificationFrame.Visible = true
VerificationTitle.Text = VerifyString.. "TEC-9?"..ResetString
YES.MouseButton1Click:Connect(function()
if WeaponBoolean.TECSELECTED and not player:WaitForChild("Backpack"):FindFirstChild("TEC9") and player:WaitForChild("Leaderstats"):WaitForChild("Level").Value >= 25 then
T:FireServer()
wait()
WeaponBoolean.TECSELECTED = false
VerificationFrame.Visible = false
end
end)
NO.MouseButton1Click:Connect(function()
VerificationFrame.Visible = false
end)
end)
P_90.MouseButton1Click:Connect(function()
bool = false
WeaponBoolean.P90SELECTED = true
VerificationFrame.Visible = true
VerificationTitle.Text = VerifyString.. "P-90?"..ResetString
YES.MouseButton1Click:Connect(function()
if WeaponBoolean.P90SELECTED and not player:WaitForChild("Backpack"):FindFirstChild("P90") and player:WaitForChild("Leaderstats"):WaitForChild("Level").Value >= 35 then
P:FireServer()
wait()
WeaponBoolean.P90SELECTED = false
VerificationFrame.Visible = false
end
end)
NO.MouseButton1Click:Connect(function()
VerificationFrame.Visible = false
end)
end)
AR.MouseButton1Click:Connect(function()
WeaponBoolean.ARSELECTED = true
bool = false
VerificationFrame.Visible = true
VerificationTitle.Text = VerifyString.. "AR?"..ResetString
YES.MouseButton1Click:Connect(function()
if WeaponBoolean.ARSELECTED and not player:WaitForChild("Backpack"):FindFirstChild("AR") and player:WaitForChild("Leaderstats"):WaitForChild("Level").Value >= 60 then
AS:FireServer()
wait()
WeaponBoolean.ARSELECTED = false
VerificationFrame.Visible = false
end
end)
NO.MouseButton1Click:Connect(function()
VerificationFrame.Visible = false
end)
end)
AK.MouseButton1Click:Connect(function()
bool = false
WeaponBoolean.AKSELECTED = true
VerificationFrame.Visible = true
VerificationTitle.Text = VerifyString.. "AK-47?"..ResetString
YES.MouseButton1Click:Connect(function()
if WeaponBoolean.AKSELECTED and not player:WaitForChild("Backpack"):FindFirstChild("AK") and player:WaitForChild("Leaderstats"):WaitForChild("Level").Value >= 45 then
G:FireServer()
wait()
WeaponBoolean.AKSELECTED = false
VerificationFrame.Visible = false
end
end)
NO.MouseButton1Click:Connect(function()
VerificationFrame.Visible = false
end)
end)
end
CurrencyHandler:
local datastore = game:GetService("DataStoreService")
local CurrencyStore = datastore:GetDataStore("Data")
--MONEY GIVER
game.Players.PlayerAdded:Connect(function(player)
local value = script.Currency:Clone()
value.Parent = player
--DATASTORE
local UserId = player.UserId
local data
local success, errormessage = pcall(function()
data = CurrencyStore:GetAsync(UserId)
end)
if success then
value.Value = data
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local UserId = player.UserId
local data = player:FindFirstChild("Currency").Value
CurrencyStore:SetAsync(UserId, data)
end)
GunShop ServerScript (where the subtractor is placed):
local UI
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if not player.PlayerGui:FindFirstChild("GunShop") then
UI = script.Parent.GunShop:Clone()
UI.Parent = player.PlayerGui
end
end)
script.Parent.TouchEnded:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
UI:Destroy()
end)
local GunEvents = game.ReplicatedStorage:WaitForChild("GunEvents")
local P = GunEvents:WaitForChild("P")
local A = GunEvents:WaitForChild("A")
local G = GunEvents:WaitForChild("G")
local T = GunEvents:WaitForChild("T")
local AS = GunEvents:WaitForChild("AS")
local RepliactedStorage = game:FindFirstChildWhichIsA("ReplicatedStorage")
local GLOCK = RepliactedStorage:WaitForChild("GLOCK17"):Clone()
local P90 = RepliactedStorage:WaitForChild("P90")
local TEC9 = RepliactedStorage:WaitForChild("TEC9")
local AK47 = RepliactedStorage:WaitForChild("AK")
local ASSAULT = RepliactedStorage:WaitForChild("AR")
local Teleport = script.Parent.Teleport
G.OnServerEvent:Connect(function(player)
local currency = player.Currency
currency.Value -= 220
wait()
GLOCK.Parent = player:WaitForChild("StarterGear")
player:LoadCharacter()
local character = player.Character
local success, errorm = pcall(function()
character:MoveTo(Teleport.Position)
end)
if not success then
warn(errorm)
end
end)
A.OnServerEvent:Connect(function(player)
AK47.Parent = player:WaitForChild("StarterGear")
player:LoadCharacter()
local character = player.Character
local success, errorm = pcall(function()
character:MoveTo(Teleport.Position)
end)
if not success then
warn(errorm)
end
end)
P.OnServerEvent:Connect(function(player)
P90.Parent = player:WaitForChild("StarterGear")
player:LoadCharacter()
local character = player.Character
local success, errorm = pcall(function()
character:MoveTo(Teleport.Position)
end)
if not success then
warn(errorm)
end
end)
T.OnServerEvent:Connect(function(player)
TEC9.Parent = player:WaitForChild("StarterGear")
player:LoadCharacter()
local character = player.Character
local success, errorm = pcall(function()
character:MoveTo(Teleport.Position)
end)
if not success then
warn(errorm)
end
end)
AS.OnServerEvent:Connect(function(player)
ASSAULT.Parent = player:WaitForChild("StarterGear")
player:LoadCharacter()
local character = player.Character
local success, errorm = pcall(function()
character:MoveTo(Teleport.Position)
end)
if not success then
warn(errorm)
end
end)