PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

Scripting Book/Chapter 17: Code Sample 3

Scripting Book/Chapter 17: Code Sample 3

Jun 23 2018, 2:08 AM PST

local tool = script.Parent
local user
script.Parent.Equipped:connect(function(mouse)
     mouse.Button1Down:connect(function()
          local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p -  tool.Handle.CFrame.p).unit*300)
          local hit, position = game.Workspace:FindPartOnRay(ray, user)
     end)
end)