CCCPaste

Plank System (QuantityText)

local Tool = script.Parent

local player = game.Players.LocalPlayer
local backpack = player.PlayerGui:WaitForChild("QuantityGui")
local Planks = backpack:FindFirstChild("Planks")
local Mouse = player:GetMouse()

Tool.Equipped:Connect(function()
	backpack.Frame.Planks.Visible = true
	
	Tool.plankstacks:GetPropertyChangedSignal('Value'):Connect(function()
		Planks.TextLabel.Text = Tool.plankstacks.Value.." / 10"
	end)
	Planks.TextLabel.Text = Tool.plankstacks.Value.." / 10"
end)

Tool.Unequipped:Connect(function()
	backpack.Planks.Visible = false
	
	
end)

local function MakePlank()

	local plank = Instance.new("Part")
	plank.Name = "Plank"
	plank.Anchored = true
	plank.Material = Enum.Material.Plastic
	
	local Pos = Mouse.Hit.Position

	plank.Size = Vector3.new(12, 0.2, 4)
	plank.Position =  Pos
	plank.Color = Color3.fromRGB(105, 64, 40)

	plank.Parent = workspace
	Tool.plankstacks.Value = Tool.plankstacks.Value - 1
end

Tool.Activated:Connect(function()
	MakePlank()
	
	while wait() do
		if Tool.plankstacks.Value == 0 then
			Tool:Destroy()
			backpack.Planks.Visible = false
			wait(1)
			break
		end
	end
end)