Stats script(Module)
local module = {
["Eff"] = 1, --efficiency
["Delay"] = .075, --Waitime between mining the blocks
["Range"] = 5 --How much blocks in range he can mine
}
function module.LoadAxe()
local players = game:GetService("Players")
local plr = players.LocalPlayer
local AxeLevel = plr.AxeLevel
if AxeLevel == "Silver" then
module["EFF"] = 1
module["Delay"] = .075
module["Range"] = 5
elseif AxeLevel == "Gold" then
module["EFF"] = 2
module["Delay"] = .05
module["Range"] = 6
elseif AxeLevel == "Diamond" then
module["EFF"] = 4
module["Delay"] = .04
module["Range"] = 7
end
end
function module.LvlChanged()
local plrs = game:GetService("Players")
local Player = plrs.LocalPlayer
local AxeLevel = Player.AxeLevel
if AxeLevel == "Silver" then
module["EFF"] = 1
module["Delay"] = .075
module["Range"] = 5
elseif AxeLevel == "Gold" then
module["EFF"] = 2
module["Delay"] = .05
module["Range"] = 6
elseif AxeLevel == "Diamond" then
module["EFF"] = 4
module["Delay"] = .04
module["Range"] = 7
end
end
return module
Upgrade Script(Local)
local plr = game.Players.LocalPlayer
local money = plr:WaitForChild("Money")
local AxeStorage = game.ReplicatedStorage.Axe
local AxeStats = require(plr.Backpack.Pickaxe.Stats)
script.Parent.MouseButton1Click:connect(function()
if money.Value >= 1000 then
AxeStats.LvlChanged()
money.Value = money.Value - 1000
script.Parent.Text = "Purchase Successful!"
wait(3)
script.Parent.Text = "Silver Pickaxe - $1000"
else
script.Parent.Text = "Not Enough Money!"
wait(3)
script.Parent.Text = "Silver Pickaxe - $1000"
end
end)
Load Axe(Script)
game.Players.PlayerAdded:connect(function(Player)
local Axe = Player.Backpack.Pickaxe
local stats = require(Axe.Stats)
stats.LoadAxe()
end)
