i need fix "attempt to compare userdata with Number"
if script then
--Script local tycoon = script.Parent.Parent.Parent local button = script.Parent local container = button.Parent local purchasedItem = script.Parent.Parent.PurchasedItem local cost = container.Cost local tycoonOwner = tycoon.TycoonOwner local itemClone = script.Parent.Parent.PurchasedItem:Clone() purchasedItem:Destroy() local function getPlayerFromPart(part) local character = part.Parent
if character then local player = game.Players:GetPlayerFromCharacter(character) return player end
end local function attemptToBuy(player) local money = player.leaderstats.Money
if money then if money.Value >= cost then money.Value = money.Value - cost
itemClone.Parent = container button:Destroy() end
end end local function onTouched(otherPart) local player = getPlayerFromPart(otherPart)
if player then if tycoonOwner.Value == player then attemptToBuy(player) <--- "Fix" end end
end button.Touched:Connect(onTouched) --Script
end