So I’m trying to make the slide of this gun move with the mouse position, but whenever you click on a place that is not the center it just kinda leaps over. I don’t want that, the slide shouldn’t just move instantly to a different place so I guess the way to do that would be to set the part center to the mouse.
It shouldn’t just leap over like that when I click it.
i think you can make a invisible part and then you teleport the invisible part to the mouse position every time you click it
then you weld the invisible part and the slide together (make sure the slide are still in the same place after you weld them)
when the player stop holding the mouse button you unweld them
basically when you weld part 0 to part 1 then part 1 position will snap to part 0 position
so you have to teleport the slide back to it old position (basically the position before you do the welding stuff)
the weld is not active (you have to unweld other stuff that are welded to the slide too)
this is the only solution i can think off to fix the leap thing
i think it didnt active because the slide are anchored
unachored the slide after you weld it then anchor it back after you unweld the slide
(how come no one have come up with other solution)
i think the other solution would be like this:
basically it still have invisible part but you dont use the weld
you would need to calculate the distance between the slide and the invisible part
and you can get the slide position by doing
attempt to call a nil value error? {Position = game.Workspace.cam.invp.Position + Vector3.New(game.Workspace.cam.gun.main.Slide.Position.X,0,game.Workspace.cam.gun.main.Slide.Position.Z) - Vector3.New(game.Workspace.cam.invp.Position.X,0,game.Workspace.cam.invp.Position.Z)}