How to make part stay inside of player? (Without welding)

Greetings,
I’d like to make a certain part stay inside of a player, I can’t use welds for this though, (complicated story) I’ve made this simple script:

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		local x = workspace.Part:Clone()
		x.Parent = workspace
		while true do
			x.Position = char.LeftHand.Position
			wait()
		end		
	end)
end)

It’s alright but there’s this annoying delay while walking


If the video didn’t load: Classic Baseplate - Roblox Studio 2021-10-16 12-06-18

Is there any way to solve this?

Are you using this code on the Server? if yes you should consider doing it on the client (Local Script) beacause when you add a loop on the server it can lag the game and that causes that delay.
Heres the code you can use for the Client:

local player = game:GetService("Players").LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait()
-- the Variables above are there instead of the function beacause if you use those
-- functions on the client it may give you an error.
local x = workspace.Part:Clone()
		x.Parent = workspace
		while true do
			x.Position = char.LeftHand.Position
			wait()
		end	

I unfortunately have to do it on the server, because I’m trying to connect said part to a Rope constraint visible to other players. (I can’t connect the rope to the player or else it’ll show an input delay for all other clients.

then you should try using body gyro and body position instead of the position of the part.

Instead while true do loop, try detecting when the player’s arm moves position instead?

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		local x = workspace.Part:Clone()
		x.Parent = workspace
		char.LeftHand:GetPropertyChangedSignal("Position"):Connect(function()
			x.Position = char.LeftHand.Position
		end)		
	end)
end)

not 100% sure if this will work

This is a good idea but it delivers the same result, since the player moves faster than the part

1 Like

Well, I’ve just tried using TweenService and it doesn’t seem too much better

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		local x = workspace.Part:Clone()
		x.Parent = workspace
		while task.wait() do
			game:GetService("TweenService"):Create(x, TweenInfo.new(0.0001), {Position = char.LeftHand.Position}):Play()
		end	
	end)
end)

I think it’s going to be quite hard to do this without welding since scripts don’t run as fast as the player

1 Like

It will be a lot more complicated to do it without welds or without a client-sided part moving script (which isn’t the fix you need), you can try using BodyMovers such as BodyPosition and BodyGyro, but if the part needs to be anchored it won’t work

(ping causes the part to be replicated to the client later than you want it to, even with as small as 50 ping it will still be late, so there’s not much of a solution i can think of)

1 Like

well uhh this thread was kind of supposed to be a solution for Problems with RopeConstraints (And Network ownership)
Does anyone maybe know how to fix that?

1 Like

Interesting.

I actually had a similar problem with one of my constraint based characters.

Unfortunately I don’t exactly know how you have setup your characters. So I am going to ask a few questions:

Is the object you are trying to pull another players character? If so you could try and set their character to the player who is pulling.

Also, have you tested on a regular server? I notice most of the time that generally on Robloxs Local Studio Server that player input seems more than normal servers.

I don’t think there is a reason why you would need to do create a part that isn’t welded to the player stick to the player.

2 Likes

Basically I’m trying to make this in order to drag dead npcs via rope constraints. I’ve tried adding the rope constraint to the player, it looks fine for the player but it looks really glitchy and weird for the server and all other clients. I’m pretty sure this is caused by some Network Ownership issues, setting it manually didn’t help either. Same result when welding a part to the player and doing it that way, that’s why I’m trying to do it this way.

Welds have never worked with players and moving objects before. It is more advisable to use Motor6Ds if you want something to attach to your player and move.

Also, if you have already tried the setting the NetworkOwnership manually and it hasn’t worked, it doesn’t sound like a network ownership issue to me. Could we see a video of the NPC pulling as it stands?

I don’t know why but Windows and Roblox recorder aren’t working at the moment, I only have this video of the person dragging it Place1 - Roblox Studio 2021-10-15 22-56-13
For other clients (and for the server) the ragdoll spins around the player, sometimes it doesn’t move or it just lags.

Why not use welding? Also, using repeating loops just to update their position is worse than welding.