Brick not moving?
Hi, I am trying to create a hopperbin that when G is pressed, creates and slowly moves a brick to the mouse's Hit.X , Y, and Z position. Although, instead of doing what it is supposed to, it moves directly to the Hit position instead of slowly moving as though it is floating. Any solution to this?
The explorer is set up as shows:
StarterPack-->HopperBin-->LocalScript
The Code:
01 | local mouse = game.Players.LocalPlayer:GetMouse() |
03 | function DecimalRound(Number, DecimalPlaces) |
04 | local Int, Dec = math.modf(Number) |
05 | local DecSet = "1" ..string.rep( "0" , DecimalPlaces) |
06 | local ToFakeInt = Dec * tonumber (DecSet) |
07 | local Convertion = math.floor(ToFakeInt) |
08 | local ToRealValue = Convertion / DecSet |
09 | local NewValue = Int + ToRealValue |
13 | mouse.KeyDown:connect( function (uKey) |
30 | local r = Instance.new( "Part" , game.Workspace) |
31 | r.CFrame = CFrame.new( 0 , 5 , 0 ) |
58 | print ( "X: " ..x.. " " ..tX) |
59 | print ( "Y: " ..y.. " " ..tY) |
60 | print ( "Z: " ..z.. " " ..tZ) |
63 | mX = DecimalRound(x, 2 ) |
64 | r.CFrame = CFrame.new(mX - 0.01 , r.CFrame.y, r.CFrame.z) |
65 | elseif xneg = = true then |
66 | mX = DecimalRound(x, 2 ) |
67 | r.CFrame = CFrame.new(mX + 0.01 , r.CFrame.y, r.CFrame.z) |
71 | mY = DecimalRound(y, 2 ) |
72 | r.CFrame = CFrame.new(r.CFrame.x, mY - 0.01 , r.CFrame.z) |
73 | elseif yneg = = true then |
74 | mY = DecimalRound(x, 2 ) |
75 | r.CFrame = CFrame.new(r.CFrame.x, mY + 0.01 , r.CFrame.z) |
79 | mZ = DecimalRound(z, 2 ) |
80 | r.CFrame = CFrame.new(r.CFrame.x, r.CFrame.y, mZ - 0.01 ) |
81 | elseif zneg = = true then |
82 | mZ = DecimalRound(z, 2 ) |
83 | r.CFrame = CFrame.new(r.CFrame.x, r.CFrame.y, mZ + 0.01 ) |
87 | r.CFrame.x = = x and r.CFrame.y = = y and r.CFrame.z = = z |
89 | if r.CFrame.x = = x and r.CFrame.y = = y and r.CFrame.z = = z then |