Shine part wont stay with tweening part

Code

script.Parent.Touched:Connect(function(hit)
	
	if hit.Parent:FindFirstChild("Humanoid") then
		
		local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
		
		if plr then
			
			local Reward = math.random(5,12)
			
			plr.leaderstats.Gems.Value += Reward
			
			script.Parent:Destroy()
			
		end
		
	end
	
end)

local FloatPos = {
	Up = Vector3.new(12.27, 2.013, 15.429);
	Down = Vector3.new(12.27, 1.513, 15.429);
}

local TS = game:GetService("TweenService")

local FloatDuration = 0.8

while true do
	
	local Change = {Position = FloatPos.Up}
	
	local Anim = TS:Create(script.Parent, TweenInfo.new(FloatDuration,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut), Change)
	Anim:Play()
	
	task.wait((FloatDuration + 0.05))
	
	local Change2 = {Position = FloatPos.Down}

	local Anim2 = TS:Create(script.Parent, TweenInfo.new(FloatDuration,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut), Change2)
	Anim2:Play()
	
	task.wait((FloatDuration + 0.05))
	
end

image
The shine mesh has anchored off but the gem mesh has anchored on

try tweening the CFrame instead of the position

Worked! Can you please explain why this worked?

I can’t fully explain, I just know that tweening part’s position when it has welds attached it won’t move the other parts. Like when you try to move a model using PivotTo or SetPrimaryPartCFrame, they accept CFrame as parameter and not position

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