I am making a tycoon button purchasing system using attributes but when i try buying things it doesent work despite the attributes of the id and button being the same.
The attributes for both models are ‘1’
Purchase handler
local Purchases = script.Parent.Purchases:GetChildren()
local debounce = false
local TycoonFolder = Instance.new("Folder", game.ReplicatedStorage)
TycoonFolder.Name = script.Parent.Name
for _, purchases in pairs((script.Parent.Purchases:GetChildren())) do
purchases.Parent = game.ReplicatedStorage:FindFirstChild(script.Parent.Name)
purchases:GetAttribute("Id")
end
for _, button in pairs((script.Parent.Buttons:GetChildren())) do
button.ProximityPrompt.Triggered:Connect(function(player)
for _, purchases in pairs((TycoonFolder:GetChildren())) do
if player ~= script.Parent.Owner.Value then continue end
local IdOfItem = button:GetAttribute("IdOfItem")
local Id = purchases:GetAttribute("Id")
print(Id)
print(IdOfItem)
if Id ~= IdOfItem then continue end
print(1)
local purchaseClone = purchases:Clone()
purchaseClone.Parent = script.Parent
end
end)
end
Owner Door:
script.Parent.Head.ProximityPrompt.Triggered:Connect(function(player)
script.Parent.Head.ProximityPrompt:Destroy()
if player ~= nil then
local PlayerStats = game.ServerStorage.PlayerStats:FindFirstChild(player.Name)
if PlayerStats ~= nil then
local ownstycoon = PlayerStats:FindFirstChild("OwnsTycoon")
if ownstycoon ~= nil then
if ownstycoon.Value == nil then
if script.Parent.Parent.Owner.Value == nil then
script.Parent.Parent.Owner.Value = player
ownstycoon.Value = script.Parent.Parent
script.Parent.Claim.DisplayName = player.Name.."'s Tycoon"
script.Parent.Head.Transparency = 0.6
script.Parent.Head.CanCollide = false
end
end
end
end
end
end)
Any help would be greatly appriciated!