So I have this script that acts as my shop system and when an item with the attribute “Singular” is marked false, you should be able to but the item as much as you want. But it doesn’t work, and it acts as if its set to true, but it prints false.
Here is important code: local folder = script.Parent
local BuySound = script.BuySound
local NoBuySound = script.NoBuySound
local tools = game.ReplicatedStorage.Tools
local promptTemplate = script.Prompt
for i, v in pairs(folder:GetChildren()) do
if not v:IsA(‘Script’) then
local prompt = promptTemplate:Clone()
local price = v:GetAttribute(‘Price’)
local name = v:GetAttribute(‘Name’)
local singular = v:GetAttribute(‘Singular’)
local item = tools:FindFirstChild(name)
prompt.Parent = v
prompt.ActionText = 'Buy - ‘… price… ’ Tix’
prompt.ObjectText = name
prompt.Enabled = true
prompt.Triggered:Connect(function(plr)
local char = plr.Character or plr.CharacterAdded:Wait()
local human = char:FindFirstChildOfClass('Humanoid')
if plr.leaderstats.Tix.Value >= price then
if not v:HasTag('Upgrade') then
print('Not upgrade')
if not singular then
print(singular)
if plr.Backpack:FindFirstChild(name) or plr.Character:FindFirstChild(name) and singular == false then
prompt.MaxActivationDistance = 0
NoBuySound:Play()
return
end
end
plr.leaderstats.Tix.Value -= price
BuySound:Play()
item:Clone().Parent = plr.Backpack
if singular then
prompt.MaxActivationDistance = 0
end
if v:HasTag('Disappear') then
v:Destroy()
end