#Errors In My Rebirth Shop Script

4 messages · Page 1 of 1 (latest)

pale schooner
#

Script 2 ```local ServerScriptService = game:GetService("ServerScriptService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local PlayerData = require(ServerScriptService.PlayerData.Manager)
local RebirthManager = require(ServerScriptService.Rebirth)
local PetsManager = require(ServerScriptService.Pets)
local RebirthsConfig = require(ReplicatedStorage.Configs.Rebirths)

local Remotes = ReplicatedStorage.Remotes

local function PurchaseItem(player: Player, mode: string, area: string, item: string)
local areaConfig = RebirthsConfig.Shop[area]
if not areaConfig then return end

local itemConfig = areaConfig[`{mode}s`][item]
if not itemConfig then return end

local profile = PlayerData.Profiles[player]
if not profile then return end

local isAreaUnlocked = area == "Spawn" or profile.Data.Islands[area]
if not isAreaUnlocked then return end

local isPurchased = profile.Data.RebirthShop[area][item]
if isPurchased == true or isPurchased == 0 then return end

local price = itemConfig.Price
local canAfford = profile.Data.Gems >= price
if not canAfford then return end

PlayerData.AdjustGems(player, -price)
if mode == "Button" then
    profile.Data.RebirthShop[area][item] = true
    RebirthManager.ForceUnlockButton(player, item)
else
    profile.Data.RebirthShop[area][item] -= 1
    local upgrade = if itemConfig.Rainbow then "Rainbow" elseif itemConfig.Golden then "Golden" elseif itemConfig.Shiny then "Shiny" else nil
    local petInstance = PetsManager.CreatePet(item, itemConfig.Rarity, upgrade)
    PetsManager.GivePet(player, petInstance)
end
Remotes.PurchaseRebirthItem:FireClient(player, mode, area, item)

end

Remotes.PurchaseRebirthItem.OnServerEvent:Connect(PurchaseItem)```

abstract dirge
#

nice copy and paste from monzterdev

pale schooner
abstract dirge
#

they have even the same variable name