--[[local EffectFunctions = 
{
	function(hum,dir) hum:TakeDamage(1) end,
	function(hum,dir) hum:TakeDamage(-1) end,
	function(hum,dir) 
		if hum.Torso then
			local nforce = Instance.new('BodyForce')
			nforce.force = dir*3000
			nforce.Parent = hum.Torso
			hum.Sit = true
			game.Debris:AddItem(nforce,.2)
			Delay(.2,function() hum.Sit = false end)
		end
	end
}]]

Tool.Equipped:connect(function(mouse)
	--game.Players.LocalPlayer:GetMouse()
	Spawn(function()
		--local colorChoice = 1
		if not Tool.Parent:FindFirstChild('Torso') or not Tool.Parent.Torso:FindFirstChild('Right Shoulder') or not Tool.Parent:FindFirstChild('Humanoid') then return end
		--LazerSound:Play()
		nweld = Tool.Parent.Torso['Right Shoulder']
		oldC0 = nweld.C0
		nweld.CurrentAngle = 0
		nweld.DesiredAngle = 0
		nweld.MaxVelocity = 0
		--[[mouse.Button1Down:connect(function()
			colorChoice=colorChoice+1
			if colorChoice>#ColorChoices then colorChoice =1 end
			LazerSound.Pitch = .75+((colorChoice*.25)*3)
		end)]]
		equipped = true
		while equipped and Tool.Parent:FindFirstChild('Torso') do
			local tframe = Tool.Parent.Torso.CFrame
			tframe = tframe + tframe:vectorToWorldSpace(Vector3.new(1, 0.5, 0))
			local taim = mouse.Hit.p -( tframe.p )
			nweld.C0 = (CFrame.new(Vector3.new(),tframe:vectorToObjectSpace(taim))*CFrame.Angles(0,math.pi/2,0))+Vector3.new( 1, 0.5, 0 )
			--rayparts = CastLightRay(Handle.CFrame.p+Handle.CFrame:vectorToWorldSpace(StartOffset[colorChoice]),mouse.Hit.p,ColorChoices[colorChoice], 5, .2,rayparts, EffectFunctions[colorChoice])
			--LazerSound.Volume = ((math.sin(tick()*3)+1)*.25)+.25
			wait()
		end
		nweld.C0 =oldC0
		--LazerSound:Stop()
	end)
end)

Tool.Unequipped:connect(function(mouse)
	equipped= false
	--LazerSound:Stop()
	for i=1,50,1 do
		--[[if rayparts[i] then
			rayparts[i]:Destroy()
			rayparts[i]=nil		
		end]]
	end
	if nweld then
		nweld.MaxVelocity =.15
		nweld.C0 =oldC0
	end
	
end)
