local main = require(game.ServerStorage.Modules.MainModule)
game.Players.PlayerAdded:Connect(function(player)
local stats = Instance.new("Folder",player)
stats.Name = "Stats"
local cards = Instance.new("Folder",stats)
cards.Name = "Cards"
local equippedCards = Instance.new("Folder",stats)
equippedCards.Name = "EquippedCards"
local b = main.CreateBool("Beam")
b.Parent = cards
local b1 = main.CreateBool("Zone")
b1.Parent = cards
for i = 1,4,1 do
local equipped = Instance.new("StringValue",equippedCards)
equipped.Name = "Card"..i
equipped.Value = "Zone"
end
player.CharacterAppearanceLoaded:Connect(function(char)
char.Archivable = true
char.Parent = workspace.Alive
end)
end)
game.ReplicatedStorage.Events.EquipCard.OnServerEvent:Connect(function(player,cardname,slotindex)
local cards = player.Stats.Cards
local equippedCards = player.Stats.EquippedCards
if cards:FindFirstChild(cardname) then
local slot = equippedCards:FindFirstChild("Card"..slotindex)
if slot.Value == cardname then
slot.Value = "None"
return
end
for _,slotv in pairs(equippedCards:GetChildren()) do
if slotv.Value == cardname then
slotv.Value = "None"
end
end
slot.Value = cardname
else
player:Kick("Choosen card wasn't found inside your inventory. Most likely exploit. Please contact developer if you think this is wrong.")
end
end)
Here’s a model file which worked for me. The folder goes inside the workspace and the script goes inside the “ServerScriptService” folder, nothing needs to be renamed.