--clockwork
print("Lets start")
local bin = script.Parent

function round(num, idp)
	local mult = 10^(idp or 0)
	return math.floor(num * mult + 0.5) / mult
end
print("Check1")

local function onClicked(mouse)
	local player = game.Players.LocalPlayer
	if player == nil then return end
print("We got the player, he clicked")
	points = player.leaderstats["Stat Points"]
	type = bin.Type.Value
	upg = player.stats[type]
	cost = math.floor(upg.Value ^ 1.45 / 10) + 1
	if(points.Value < cost) then return end
	if(upg.Value >= 4999) then return end
	print("Lets upgrade")
	upg.Value = upg.Value + 1
	player.leaderstats["Level"].Value = player.leaderstats["Level"].Value + 1
	points.Value = points.Value - cost
	bin.Name = type .. ": " .. upg.Value
	print("End of the process clicked")
end

function onSelected(mouse)
	print("select")
	mouse.Button1Down:connect(function() onClicked(mouse) end)
end

bin.Selected:connect(onSelected)

When clicking, it doesn't do anything, but selecting it is fine. Is there any way to edit this?

2 comments

0

What are you asking us to help you with? You want to know if there any way to edit this? Yes.

0

I need help with making the local function onClicked(mouse) work correctly with a hopperbin tool.