Can I get help with mouse properties issues?
Asked by
7 years ago Edited 7 years ago
Hello,
I want an instance ; a part , to face the mouse once a tool is activated.
I have tried many trigonometric functions but it is still not pointing towards my mouse once it is fired.It is a simple script because I am new to RbxLua.
I have already searched in the forums , on the roblox wiki and Google'd the issue , but no result till now.
01 | Tool.Activated:connect( function () |
02 | local function weld(w) |
03 | local We = Instance.new( "Weld" ,chr.UpperTorso) |
04 | We.Part 1 = chr.UpperTorso |
06 | We.C 1 = chr.UpperTorso.CFrame:inverse() |
07 | We.C 0 = w.CFrame * CFrame.new( 0 , 0 , 0 ) |
11 | local x = Instance.new( "Part" , workspace) |
13 | x.BrickColor = BrickColor.Random() |
16 | local bg = Instance.new( "BodyGyro" ,x) |
17 | bg.MaxTorque = Vector 3. new( math.huge , math.huge , math.huge ) |
20 | local bp = Instance.new( "BodyPosition" , x) |
21 | bp.Position = mouse.Hit.p |
22 | x.CFrame = CFrame.new(x.CFrame.p , mouse.Hit.p) |
27 | x.Transparency = x.Transparency + 0.0005 |
Thank you for your time.
P.S : Runs in a local script, no errors , FilteringEnabled is OFF.