Set part center to mouse position? / Not make part leap over

delete the “game.Workspace.cam.invp.Position +” thing because you only need that when you move the slide

still the same error.

local Tween = TweenService:Create(game.Workspace.cam.gun.main.Slide, TweenInfo.new(.1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {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)})|
Tween:Play()

then try to print the distance then
also you need to get the distance after you click the slide not when you create the tween

	if input.UserInputType == Enum.UserInputType.MouseButton1 and game.Players.LocalPlayer:GetMouse().Target == game.Workspace.cam.gun.main.Slide then
		doing = true
		local Distance = 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)
		while doing do
			if (game.Workspace.cam.gun.main.Slide.normal.Position.Magnitude - game.Workspace.cam.gun.main.Slide.Position.Magnitude) < 0.2827281951904297 and (game.Workspace.cam.gun.main.Slide.normal.Position.Magnitude - game.Workspace.cam.gun.main.Slide.Position.Magnitude) > -0.001956939697265625 then
				game.Workspace.cam.invp.Position = Vector3.new(game.Workspace.cam.gun.main.Slide.normal.Position.X,game.Workspace.cam.gun.main.Slide.normal.Position.Y,mouse.Hit.Position.Z)	
				local Tween = TweenService:Create(game.Workspace.cam.gun.main.Slide, TweenInfo.new(.1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {Position = game.Workspace.cam.invp.Position + Distance})
				Tween:Play()
			end
			wait(0.01)
		end
	end

this still has the same error code at distance.

replace New with new
i forgot that you dont have to cap the first letter of the new word

so it works now but it still does the exact same thing where when i click it it just goes exactly to where my mouse is immediately. edit: it still does it but just not in the same way, lemme make a vid

maybe try this

local Distance = (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)).Magnitude

and

Position = Vector3.new(InvP.Position.X + Distance,0,0)

you might want to change the axis if it goes to the wrong side

i just notice that there are no invisible part tp-ing thing in the script

what? could you elaborate i didnt understand

so basically you didnt write the line where you move the invisible part to the mouse

i did. its game.Workspace.cam.invp.Position = Vector3.new(game.Workspace.cam.gun.main.Slide.normal.Position.X,game.Workspace.cam.gun.main.Slide.normal.Position.Y,mouse.Hit.Position.Z) wait nevermind i didnt put it before i got distance let me try with that nope still doesnt work

this slide thing are only for display and not related to any major mechanic right ?

yep, thats true. 30chaaaaarssssss

maybe you can focus on other script stuff instead and come back to this later
this is taking way too long

1 Like

ikr. thirtychaarrrarractersissad

Hey, found a solution. It can be done with pivotoffset BasePart.PivotOffset .

Oh I forgot that exist
(Character limit)