I did temporary variables (everything set to 1), and there isn’t an error.
print("[Stage 2/nil] Loading server "..script.Name);local startTick = tick()
local ZoneModule = require(4958963725)
local Regions = workspace.Regions
local TweenService = game:GetService("TweenService")
local Hit = 1
local caculatedXP = 09
local function makeLoot(Player)
if not Player.Character:FindFirstChild("Loot") and (Player.Team == game.Teams.Rebels or Player.Team == game.Teams.Citizens or tostring(Player.Team) == "Demolisher") then
local newValue = Instance.new("NumberValue")
newValue.Parent = Player.Character
newValue.Name = "Loot"
newValue.Value = 0
local newMax = Instance.new("NumberValue")
newMax.Parent = newValue
newMax.Name = "MaxLoot"
newMax.Value = 5000
end
end
for _,v in pairs(workspace.LootPoints:GetChildren()) do
if v:IsA("Part") then
v.Touched:Connect(function(Hit)
end)
local Humanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
if Humanoid then
local Player = game.Players:GetPlayerFromCharacter(Humanoid.Parent)
if Player then
if Player.Character:FindFirstChild("Loot") then
local PlayerCredits = Player:WaitForChild("PlayerData"):WaitForChild("Credits")
PlayerCredits.Value = PlayerCredits.Value + Player.Character.Loot.Value
game.ReplicatedStorage.Remotes.System:FireClient(Player,"StatChange",{"Credits",Player.Character.Loot.Value})
local caculatedXP = Player.Character.Loot.Value * 0.1
end
game.ReplicatedStorage.Remotes.System:FireClient(Player,"StatChange",{"XP",caculatedXP})
Player.PlayerData.PlayerXP.CurrentXP.Value = Player.PlayerData.PlayerXP.CurrentXP.Value + math.floor(caculatedXP)
Player.Character.Loot:Destroy()
end
--// Bank Setup
local BankDataValues = {Cooldown = false,InProgress = false,TimeLeft = 180}
local BankRegion = Regions.Bank
local BankZone = ZoneModule.new(BankRegion,14)
local VaultParts = workspace.BankParts
for _,v in pairs(VaultParts.VaultDoor:GetChildren()) do
local newWeld = Instance.new("WeldConstraint")
newWeld.Parent = VaultParts.Hinge
newWeld.Part0 = VaultParts.Hinge
newWeld.Part1 = v
v.Anchored = false
end
for _,v in pairs(VaultParts.Lasers:GetChildren()) do
local dmgTable = {}
spawn(function()
while true do
TweenService:Create(v,TweenInfo.new(0.3,Enum.EasingStyle.Sine),{CFrame = v.CFrame * CFrame.new(0,v.Goal.Value,0)}):Play()
wait(0.8)
TweenService:Create(v,TweenInfo.new(0.3,Enum.EasingStyle.Sine),{CFrame = v.CFrame * CFrame.new(0,-v.Goal.Value,0)}):Play()
wait(0.8)
end
end)
v.Touched:Connect(function(Touch)
local Humanoid = Touch.Parent:FindFirstChild("Humanoid") or Touch.Parent.Parent:FindFirstChild("Humanoid")
if Humanoid then
if not table.find(dmgTable,Humanoid.Parent.Name) then
table.insert(dmgTable,1,Humanoid.Parent.Name)
Humanoid:TakeDamage(47)
delay(0.6,function()
table.remove(dmgTable,table.find(dmgTable,Humanoid.Parent.Name))
end)
end
end
end)
end
local function tweenBankDoor(State)
if State == "Open" then
TweenService:Create(VaultParts.Hinge,TweenInfo.new(3,Enum.EasingStyle.Sine),{CFrame = VaultParts.Hinge.CFrame*CFrame.Angles(0,math.rad(100),0)}):Play()
elseif State == "Close" then
TweenService:Create(VaultParts.Hinge,TweenInfo.new(3,Enum.EasingStyle.Sine),{CFrame = VaultParts.Hinge.CFrame*CFrame.Angles(0,math.rad(-100),0)}):Play()
end
end
local function startBankRob()
local lastTick = tick()
BankDataValues.TimeLeft = 90
game.ReplicatedStorage.Remotes.System:FireAllClients("guiMessage",{"Bank Robbery","The Extrovian central bank is being robbed! Military personnel respond as soon as possible!",8})
BankRegion.Detector.Alarm:Play()
spawn(function()
repeat wait(0.3)
if tick()-lastTick >= 1 then
BankDataValues.TimeLeft = BankDataValues.TimeLeft - 1
lastTick = tick()
end
for _,Player in pairs(BankZone:getPlayers()) do
if Player.Team ~= game.Teams["Falcon Imperium"] then
if Player.Character:FindFirstChild("Loot") then
if Player.Character.Loot.Value <= Player.Character.Loot.MaxLoot.Value then
Player.Character.Loot.Value = Player.Character.Loot.Value + math.random(5,30)
if Player.Character.Loot.Value > Player.Character.Loot.MaxLoot.Value then
Player.Character.Loot.Value = Player.Character.Loot.MaxLoot.Value
end
end
else
makeLoot(Player)
end
end
end
until BankDataValues.TimeLeft <= 0
for _,Player in pairs(BankZone:getPlayers()) do
Player.Character.HumanoidRootPart.CFrame = workspace.TeleportPoints.BankPoint.CFrame
end
tweenBankDoor("Close")
BankRegion.Detector.Alarm:Stop()
BankDataValues.Cooldown = true
BankDataValues.InProgress = false
wait(300)
local counter = 300
if #game.Teams["Falcon Imperium"]:GetPlayers() >= 3 then
BankDataValues.Cooldown = false
tweenBankDoor("Open")
else
repeat wait(1)
counter = counter - 1
until #game.Teams["Falcon Imperium"]:GetPlayers() >= 3 or counter == 0
BankDataValues.Cooldown = false
tweenBankDoor("Open")
end
end)
end
BankZone.PlayerAdded:Connect(function(Player)
if not BankDataValues.Cooldown and Player.Team ~= game.Teams["Falcon Imperium"] then
if BankDataValues.InProgress then
else
BankDataValues.InProgress = true
startBankRob()
end
end
end)
--// Jewelry Store
local JewelryDataValues = {Cooldown = false,InProgress = false,TimeLeft = 120}
local JewelryRegion = Regions["Jewelry Store"]
local JewelryZone = ZoneModule.new(JewelryRegion,45)
local JewelParts = workspace.JewelryParts
local function resetJewelStore()
for _,Case in pairs(JewelParts.Cases:GetChildren()) do
Case.Glass.CanCollide = true
Case.Glass.Transparency = 0.7
Case.BrokenCase.Value = false
for _,Ring in pairs(Case.Rings:GetChildren()) do
for _,Part in pairs(Ring.RingModel:GetChildren()) do
Part.Transparency = 0
end
end
end
end
local function tweenJewlDoor(State)
if State == "Open" then
TweenService:Create(JewelParts.MainDoor,TweenInfo.new(1.5,Enum.EasingStyle.Sine),{CFrame = JewelParts.MainDoor.CFrame*CFrame.new(0,24,0)}):Play()
elseif State == "Close" then
TweenService:Create(JewelParts.MainDoor,TweenInfo.new(0.9,Enum.EasingStyle.Sine),{CFrame = JewelParts.MainDoor.CFrame*CFrame.new(0,-24,0)}):Play()
end
end
tweenJewlDoor("Open")
local function startJewelryRob()
local lastTick = tick()
JewelryDataValues.InProgress = true
JewelryDataValues.TimeLeft = 180
game.ReplicatedStorage.Remotes.System:FireAllClients("guiMessage",{"Store Robbery","The jewelry store is being robbed! Extrovian military personnel, respond as soon as you can.",7.5})
JewelryRegion.Detector.Alarm:Play()
tweenJewlDoor("Close")
for _,Player in pairs(JewelryZone:getPlayers()) do
if JewelryDataValues.InProgress then
game.ReplicatedStorage.Remotes.System:FireClient(Player,"guiMessage",{"Game Help","You're robbing the jewelry store! Touch case glass to break it, then touch the rings to steal them! Make sure you escape before the time is up!",8})
end
end
spawn(function()
repeat wait(0.3)
if tick()-lastTick >= 1 then
JewelryDataValues.TimeLeft = JewelryDataValues.TimeLeft - 1
lastTick = tick()
end
until JewelryDataValues.TimeLeft <= 0 or #JewelryZone:getPlayers() == 0
for _,Player in pairs(JewelryZone:getPlayers()) do
Player.Character.HumanoidRootPart.CFrame = workspace.TeleportPoints.JewelryPoint.CFrame
if Player.Character:FindFirstChild("Loot") then
Player.Character.Loot:Destroy()
end
end
JewelryRegion.Detector.Alarm:Stop()
JewelryDataValues.Cooldown = true
JewelryDataValues.InProgress = false
resetJewelStore()
local cooldown = 300
if #game.Teams["Falcon Imperium"]:GetPlayers() < 3 then
cooldown = 600
end
delay(cooldown,function()
JewelryDataValues.Cooldown = false
tweenJewlDoor("Open")
end)
end)
end
game.ReplicatedStorage.Remotes.Binds.Jewelry.Event:Connect(function(Player,Request,Ring)
if Request == "StealRing" then
if JewelryDataValues.InProgress and not JewelryDataValues.Cooldown then
local function safeCheck()
if Player.Character:FindFirstChild("Loot") then
if Player.Character.Loot.Value < Player.Character.Loot.MaxLoot.Value then
return true
else
return false
end
else
return true
end
end
if table.find(JewelryZone:getPlayers(),Player) and safeCheck() then
if not Player.Character:FindFirstChild("Loot") then
makeLoot(Player)
end
Player.Team = game.Teams.Rebels
game.ReplicatedStorage.Remotes.Binds.ApplyMorph:Fire("applyGamepass",{"Rebel",Player})
game.ReplicatedStorage.Remotes.Binds.NameTag:Fire("setNametag",{"Rebels",Player})
if Player.Character.Loot.Value < Player.Character.Loot.MaxLoot.Value then
Player.Character.Loot.Value = Player.Character.Loot.Value + math.random(45,200)
end
if Player.Character.Loot.Value > Player.Character.Loot.MaxLoot.Value then
Player.Character.Loot.Value = Player.Character.Loot.MaxLoot.Value
end
for _,v in pairs(Ring.RingModel:GetChildren()) do
v.Transparency = 1
end
end
end
end
end)
for _,Case in pairs(JewelParts.Cases:GetChildren()) do
Case.Glass.Touched:Connect(function(Hit)
local targetHumanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
if targetHumanoid then
local targetPlayer = game.Players:GetPlayerFromCharacter(targetHumanoid.Parent)
if targetPlayer then
if not JewelryDataValues.InProgress and not JewelryDataValues.Cooldown and not Case.BrokenCase.Value then
startJewelryRob()
Case.BrokenCase.Value = true
Case.Glass.Transparency = 1
Case.Glass.CanCollide = false
elseif JewelryDataValues.InProgress and not JewelryDataValues.Cooldown and not Case.BrokenCase.Value then
Case.BrokenCase.Value = true
Case.Glass.Transparency = 1
Case.Glass.CanCollide = false
end
end
end
end)
end
end
local JewelParts = 1
local JewelryDataValues = 1
local JewelryZone = 1
JewelParts.JewelryVentHit.Touched:Connect(function(Hit)
local targetHumanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
if targetHumanoid then
targetHumanoid.Parent.HumanoidRootPart.CFrame = workspace.TeleportPoints.JewelryPoint.CFrame
end
end)
JewelryZone.PlayerAdded:Connect(function(Player)
game.ReplicatedStorage.Remotes.System:FireClient(Player,"guiMessage",{"Game Help","You're robbing the jewelry store! Touch case glass to break it, then touch the rings to steal them! Make sure you escape before the time is up!",8})
if not JewelryDataValues.InProgress and JewelryDataValues.Cooldown then
Player.Character.HumanoidRootPart.CFrame = workspace.TeleportPoints.JewelryPoint.CFrame
end
end)
--// Loops
JewelryZone:initLoop(0.1)
BankZone:initLoop(0.1)
end
end
--// reminders
--warn("[ALERT]: JEWELRY STORE COOLDOWN SET TO 60 SECONDS FOR TESTING, SHOULD BE 300")
print("[Stage 2/nil] Loaded server "..script.Name.." ("..tick()-startTick..")")
In my code, ignore this stuff, it’s to stopp Unknown Global errors
local Hit = 1
local caculatedXP = 09
|||local JewelParts = 1
|||local JewelryDataValues = 1
|||local JewelryZone = 1