Tycoon Sell Brick Script Not Working

Hey there,
I just recently started making a tycoon from scratch and currently am trying to code the sell brick. Although whenever a drop touches it, nothing happens, not even an error. I’ve attached the script for the sell brick.
I’d appreciate any help I can get, thank you!

Sell Brick Script

well you can shorten it by doing it like this, also add in some prints to find if your script is running and for some reason roblox doesn’t like it when you set a Value as a variable then try to add to it so change that to the object then call the value later (All will make sense in the script I hope)

local tycoon = script.Parent.Parent.Parent
local drops = tycoon.Drops

local function sellObject(product)
 if product.Parent == drops then
  local Player = game.Players[tycoon:GetAttribute('Owner')
  if Player then
   local leaderstats = player:WaitForChild('leaderstats')
   local Coins = leaderstats:WaitForChild('Coins')
   local Value = product:GetAttribute('DropValue')
   
  Coins.Value += Value
  end
 end
end

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.