Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a part follow a player?

I'm making a title script to appear above my head, and I don't know how to make it follow my head, help(also I know people will say to use UserId but rn i'm not planning on changing my nae so it works)

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:connect(function(charcter)
		if player.Name == "Brockanthony10" then
			print("Player is Brockanthony10")
			local kingTitle = game.Lighting.kingTitle:Clone()
			wait(0.8)
			kingTitle.Parent = game.Workspace.Brockanthony10
			kingTitle.Position = game.Workspace.Brockanthony10.Head.Position
		end
	end)
end)

2 comments

0

use welds, i suggest using the weld editor in moon animator suite

0

Take a look a Spooks HD’s tutorial on this. It will help greatly.

2 answers

✓ Accepted answer
game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		if player.Name == "Brockanthony10" then
			local x = game.Lighting.KingTitle:Clone()
			wait()
			x.Parent = workspace:WaitForChild("Brockanthony10")
			local xyz = Vector3.new(workspace["Brockanthony10"].Head.Position.X, workspace["Brockanthony10"].Head.Position.Y+2, workspace["Brockanthony10"].Head.Position.Z)
			x.Position = xyz
		end
	end)
end)

1 comment

0

In the "x.Position = xyz", add a while true do loop, and right before the x.Position add a wait()

First of all, using the UserId is a good practice to get into, even if you don't plan on changing your name.

Second of all, try putting it in a while true do loop.

3 comments

0

This lags Roblox Studio anyother ideas?

0

welds?

0

while true do is laggy, maybe change it to while wait() do

This discussion is preserved as it was. New answers, comments, and votes are closed.