Position Changing

I want to make so if the torso’s position is changed, the music note follows it. Right now when I run the code and move my character the music note tweens in the old positions. Here’s my code.

local function ShowMusicNote()
		local Head = Character.Head
		local Torso = Character.UpperTorso
		
		local MusicNote = game.ReplicatedStorage.Objects.MusicNoteSystem.MusicNote:Clone()
		MusicNote.Parent = Head
		MusicNote.Position = Vector3.new(Torso.Position.X, Torso.Position.Y, Torso.Position.Z -3)
		MusicNote.Anchored = true
		
		wait()
		local TweenService = game:GetService("TweenService")
		local Tween1 = TweenService:Create(MusicNote, TweenInfo.new(2), {Position = Vector3.new(Head.Position.X, Head.Position.Y +3, Head.Position.Z)})
		local Tween2 = TweenService:Create(MusicNote, TweenInfo.new(2), {Position = Vector3.new(Torso.Position)})
	
		Tween1:Play()
		wait(1)
		Tween2:Play()
		wait(1)
		MusicNote:Destroy()
end

If you know a solution please let me know!
1 Like

Could you explain your problem a bit better? Is it that the music note is tweening from the old position?

2 Likes

Yes, that’s exactly the problem. The music note is tweening from the old position of the Torso. I’m trying to make so if the Torso moves the music note will be “connected” to the new position of the Torso.

1 Like

If that’s the case, you need to reposition the music note before playing the tween. That way, the music note starts at the player’s torso, goes above his head, and back.

If you want the music note to literally act like its connected to the player, consider just repeatedly change the CFrame of the music note manually instead of tweening it.

1 Like