`Grouped` projectile Tween

I am working on an archer tower.

I want the arrow to travel from the bow to the target.

I am using a script similar the ones I have used in several other towers:

Summary
local arrowClone = arrow:Clone()
		arrow.Parent = workspace
		arrow.PrimaryPart.Position = proj
		
		local newPosition = target.HumanoidRootPart.Position
		local tween	= TweenService:Create(arrowClone.PrimaryPart, info, {Position = newPosition})
		tween:Play()
		target.Humanoid:TakeDamage(damage+(damage*damageIncrease))

The only difference is that this tower uses a Grouped projectile instead of a single part.

Whenever the tower Fires, the arrow spawns into the position it was in before being in Replicated Storage, and falls through the map. Instead of spawning into the set proj position, and does not follow the tween.

There are no errors in Output

2 Likes

Groups cannot use tweens so you will probably have to add animations with PivotTo() which is the way to position models

1 Like

I went ahead and made the group a Union.

Now the arrow spawns in the correct location, but falls through the map immediately.

This is the tween info:

local info = TweenInfo.new(.5,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	0,
	false)
1 Like

maybe you forgot to anchor it?

1 Like

Anchoring it stops it from falling through the map, but doesn’t allow the tween to play

Using unions is a very inefficient use of memory and I strongly recommend you don’t use them.

If you still will use them, to fix your anchor issue, when the tween is playing it should stop the projectile from falling down. Then, when the tween finished playing you can anchor it.

1 Like

Would a blender model be better on memory?

I don’t need the arrow anchored I just need the tween to work, so I’ll test it with the union for now.

I added prints to the script to see if everything was working, and it is, but the arrow still only falls.

As you can see from the image above, the arrows position on spawn, and its target location, as well as TWEEN DONE which is within a tween.Completed function

Tween Info:

Summary
local info = TweenInfo.new(.5,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	0,
	false)

Tween Creation + Prints:

Summary
local arrowClone = arrow:Clone()
		arrow.Parent = workspace
		arrow.Position = proj
		
		local newPosition = target.HumanoidRootPart.Position
		local tween	= TweenService:Create(arrowClone, info, {Position = newPosition})
		print("ARROW POSITION: ", arrow.Position,"-- TARGET POSITION: ", newPosition)
		tween.Completed:Connect(function()
			print("TWEEN DONE")
		end)
		
		tween:Play()
		target.Humanoid:TakeDamage(damage+(damage*damageIncrease))

A blender model would be better for memory than a union. However, there might be many collision issues with that. Also, sry but I haven’t really understood the problem that you are experiencing rn

1 Like

The issue was caused by a misspelling in the script.

Issue code:

local arrowClone = arrow:Clone()
		arrow.Parent = workspace
		arrow.Position = proj

Fixed code:

local arrowClone = arrow:Clone()
		arrowClone.Parent = workspace
		arrowClone.Position = proj

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