CCCPaste

New Wood System 2 (Planks)

local Tool = script.Parent

local player = game.Players.LocalPlayer
local backpack = player.PlayerGui:WaitForChild("BackpackGui")
local Planks = backpack.Frame:WaitForChild("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.Frame.Planks.Visible = false
	
	
end)

Tool.Activated:Connect(function()
	local plank = Instance.new("Part")
	plank.Name = "Plank"
	plank.Anchored = true
	plank.Material = Enum.Material.WoodPlanks

	local Pos = Mouse.Hit.Position

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

	plank.Parent = workspace
	Tool.plankstacks.Value = Tool.plankstacks.Value - 1
	
	while wait() do
		if Tool.plankstacks.Value == 0 then
			Tool:Destroy()
			backpack.Frame.Planks.Visible = false
			wait(1)
			break
		end
	end
end)