Trying to make draggable player

hello! i made this script that when u click a player, it brings the player to the mouse position and updates the characters position when the mouse is moved. problem is, is that it glitches out when i click it. the character kinda hits the camera ig?

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local plr = Players.LocalPlayer
local char = plr.Character
local mouse = plr:GetMouse()
local rightArm = char["Right Arm"]
local rightShoulder:Motor6D = char.Torso["Right Shoulder"]

mouse.Button1Down:Connect(function()
local charac = mouse.Target.Parent
local otherplr = game.Players:GetPlayerFromCharacter(charac)

if otherplr then

	RunService.RenderStepped:Connect(function()
local otherchar = otherplr.Character

for i, desc in otherchar:GetDescendants() do
	if desc:IsA("BasePart") or desc:IsA("MeshPart") then
		desc.CFrame = mouse.Hit
	end
end
	end)
	end
end)

That happens because whenever it moves the player, mouse.Target hits the character again You should do

mouse.TargetFilter = charac
1 Like

absolute legend. tysm 4 this! :slight_smile:

1 Like

You are welcome!

sssssssssssss

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.