-- R6 only!


repeat game:GetService("RunService").Stepped:Wait() until game.Players.LocalPlayer
local player = script.Parent.Parent
local mouse = player:GetMouse()
local selecting = false
local valve

local enabled = false
mouse.Button1Up:Connect(function()
	if selecting == true then
		 valve = mouse.Target
		if valve.Name == 'paper' then
			if enabled == false then
				script.Parent.Image.image.ImageLabel.Image = valve.Decal.Texture
				enabled = true
				
			elseif enabled == true then
				enabled = false
			end
			
			script.Parent.Image.Enabled = enabled
		
		end
	end
end)

mouse.Button1Up:Connect(function()
			if enabled == true then
				enabled = false
	script.Parent.Image.Enabled = enabled
	end
end)

while wait() do		
	if mouse.Target then
		if mouse.Target.Name == 'paper' then
				if not mouse.Target:FindFirstChild('selection') and script.Parent.IsUsingValve.Value == false then
					box = script.Parent.ValveUI.selection:clone()
				box.Parent = mouse.Target
				
					selecting = true
					box.Adornee = mouse.Target
				end
		else
				selecting = false
				if box then
					box:Destroy()
				end
			end
		
	end	
end

