How to make this part perfect in players hand?
Hey fellow ScriptingHelpers users, Im making a Piggy style game and I
m making it to hold only one item per person and this is my keycard script (All others keys are perfect with same script but with different math) and no, ffs not making those parts tools as it would break the "concept" of the game.
01 | local key = script.Parent |
03 | script.Parent.ClickDetector.MouseClick:Connect( function (player) |
04 | local char = player.Character |
06 | if char:FindFirstChild( "Chave" ) then |
07 | local oldKey = char:FindFirstChild( "Chave" ) |
08 | oldKey.Parent = workspace |
09 | oldKey.WeldConstraint:Destroy() |
10 | oldKey.CFrame = key.CFrame * CFrame.Angles( 0 ,math.rad( 45 ), 0 ) |
11 | oldKey.CanCollide = true |
14 | if char:FindFirstChild( "Martelo" ) then |
15 | local oldKey = char:FindFirstChild( "Martelo" ) |
16 | oldKey.Parent = workspace |
17 | oldKey.WeldConstraint:Destroy() |
18 | oldKey.CFrame = key.CFrame * CFrame.Angles( 0 ,math.rad( 45 ), 0 ) |
19 | oldKey.CanCollide = true |
23 | key.CFrame = char.RightHand.CFrame * CFrame.Angles(math.rad( 180 ), math.rad( 22.427 ), math.rad(- 232.931 )) |
25 | local weld = Instance.new( "WeldConstraint" ) |
28 | weld.Part 1 = char.RightHand |
29 | key.CanCollide = false |
Screenshot: http://pays.host/uploads/b0425be8-fb89-4d7b-a116-2fc30390e660/mGivtSmT.png
The problem is the commented line, I would be SO much appreaciated if someone helped me, thanks!