Hello.
I would like to know how to make Laser Fingers point at the cursor when my right arm is still and not moving.
Laser Fingers are a gear made by ROBLOX consisting of a red laser (draining health), a green laser (adding health) and a blue laser (pushing the humanoid target). By simply clicking left mouse button, the type and color of the laser are changed. The lasers shoot always when the tool is equipped.
However, I wish to change it a little bit.
I want to make it have the only blue laser and not moving the right arm.
I succeeded in leaving only the blue laser, but I still struggle with making the arm completely still and only the laser pointing at the cursor.
I tried to delete lines regarding the arm, but it did not work.
The tool is composed of a LocalScript and a Handle (Handle is with Audio and Mesh in it).
The whole script looks like this:
--[[Super Util]]-- function WaitForChild(parent,...) local debugPrint = false for _, i in ipairs({...}) do if type(i)=='boolean' then debugPrint = i else while not parent:FindFirstChild(i) do wait(1/30) if debugPrint then print(script.Name..':'..parent.Name..' Waiting for '.. i) end end parent=parent[i] end end return parent end function ForEach(parent,func) if type(parent)=='table' then for _,i in pairs(parent) do func(i) end else for _,i in pairs(parent:GetChildren()) do func(i) end end end function MakeValue(class,name,value,parent) local temp = Instance.new(class) temp.Name = name temp.Value = value temp.Parent = parent return temp end function TweenProperty(obj, propName, inita, enda, length,sentinel) local startTime = tick() local mySentinel = sentinel.Value local diff = enda-inita while tick()-startTime<length and mySentinel==sentinel.Value do obj[propName] = (((tick()-startTime)/length)*diff)+inita wait(1/30) end obj[propName] = enda end --[[Constants]]-- --[[Workspace Variables]]-- local Tool = script.Parent local Handle = WaitForChild(Tool,'Handle') local LazerSound = WaitForChild(Handle,'Lazer') --[[Script Variables]]-- --[[Script Functions]]-- function CastLightRay(startPos,endPos,color,segLength,segSpeed,parts,effectfunc) local part, nend = game.Workspace:FindPartOnRay( Ray.new(startPos,(endPos-startPos).unit*999.999),Tool.Parent) if nend then endPos = nend end if part and part.Parent then if part.Parent:FindFirstChild('Humanoid') and part.Parent ~=Tool.Parent then effectfunc(part.Parent.Humanoid,(endPos-startPos).unit) elseif part.Parent.Parent and part.Parent.Parent:FindFirstChild('Humanoid') and part.Parent.Parent~=Tool.Parent then effectfunc(part.Parent.Parent.Humanoid,(endPos-startPos).unit) end end local numSegments = math.floor(math.min((startPos-endPos).magnitude/segLength,50)) local initNumParts = #parts for i=numSegments,initNumParts,1 do if parts[i] then parts[i]:Destroy() parts[i]=nil end end for i=1,numSegments,1 do if not parts[i] then parts[i] = Instance.new('Part') parts[i].Parent = Tool parts[i].Anchored = true parts[i].FormFactor = 'Custom' parts[i].Size = Vector3.new(0,0,segLength) parts[i].CanCollide = false local tlight = Instance.new('PointLight') tlight.Name = 'Light' tlight.Parent = parts[i] end parts[i].BrickColor = color parts[i]:WaitForChild('Light').Color = color.Color parts[i].Light.Range =((math.sin(tick()*3)+1)*1)+5 parts[i].Light.Brightness =((math.sin(tick()*3)+1)*1)+1 parts[i].CFrame = CFrame.new(((i-.4)*(endPos-startPos).unit*segLength)+startPos,endPos) end return parts end --[[Running Logic]]-- local equipped = false local rayparts = {} local ColorChoices = {BrickColor.new('Toothpaste')} local StartOffset = {Vector3.new(-.45,0,0),Vector3.new(0,0,0),Vector3.new(.45,0,0)} local oldC0 =nil local nweld local EffectFunctions = { 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)
I am looking forward for a solution or merely an advice.
Thank you.