In this part of a script:
move.CFrame = CFrame.new(10,0,0)
Say that 'ham's' old position was (0, 0, 0) then it would move 10 studs along the X axis, however it seems to teleport rather than move smoothly along, is there a way to make it move smoothly? Perhaps using the (body)velocity of the part to make it smooth? Please amend my script to make it smoothly run Also can you make the speed in which it moves changeable too. The damage it deals on touch with a ROBLOXian (Lets say 40) Finally please may you annotate along the way? Thanks.
To make a brick move smoothly you'll need to have a loop that runs a fair amount of times with a small wait and small movement increments.
part = script.Parent -- Object Tree location of part speed = .1 -- Speed of the movements, the lower the number, the faster and more smooth distance = 10 --The distance to move along the axis timestorun = distance * 10 -- Times to run, don't change this as it allows for smooth transitions for i = 1, timestorun do -- i represents the index or current position of the loop, it starts at one and goes to whatever the times to run is, meaning it will run that many times wait(speed) -- Wait for the designated speed time part.CFrame = CFrame.new(part.Position + Vector3.new(0.1,0,0)) -- Change the CFrame by 0.1 to allow for a smooth transition end -- End the loop