Velocity properties not updating

So this might be a pain to look at, but here.
I have no clue why the velocity is not updating, I set the values and stuff.

			local char = plr.Character or plr.CharacterAdded:Wait()
			
			local projectile = projectileExists:Clone()
			local velocity = Instance.new("BodyVelocity")
			local weld = Instance.new("WeldConstraint")
			
			local animation = Instance.new("Animation")
			local animator = char.Humanoid.Animator or Instance.new("Animator", char.Humanoid)

			local offset = CFrame.new(0,0,-4)
			
			animation.AnimationId = "rbxassetid://"..animId
			local animTrack = animator:LoadAnimation(animation)
			
			weld.Part0 = projectile
			weld.Part1 = char.HumanoidRootPart
			weld.Parent = projectile

			char.Humanoid.WalkSpeed = 0
			
			animTrack:Play()
			projectile.CFrame = char.HumanoidRootPart.CFrame * offset * CFrame.Angles(90,0,0)
			
			projectile.Parent = workspace.Projectiles
			projectile.Sound:Play()
			
			velocity.Velocity = Vector3.new(0,0,0)
			velocity.Parent = projectile

			animTrack.Stopped:Connect(function()
				weld:Destroy()
				
				char.Humanoid.WalkSpeed = 16
				projectile.CanCollide = false

				velocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
				velocity.Velocity = char.HumanoidRootPart.CFrame.LookVector*500

				projectile.Touched:Connect(function(hit)
					local player = Players:GetPlayerFromCharacter(hit.Parent)
					local debounce = false

					if hit.Parent.Name ~= plr.Name and hit.Parent:FindFirstChild("Humanoid") and not debounce then
						debounce = true

						hit.Parent.Humanoid.Health -= dmg
						projectile:Destroy()
						
						if player then
							local frame = player.PlayerGui.ScreenGui.WaterSplashFrame
							frame.BackgroundTransparency = 0
							
							local info = TweenInfo.new(2.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0,false,0)
							local goals = {BackgroundTransparency = 1}							
							local tween = TweenService:Create(frame,info,goals)
							
							tween:Play()
						end
					end
				end)

				Debris:AddItem(projectile, 10)

Try using the lua debugger to step through your code line-by-line.

Just letting you know, It’s team create and this works without team create.

There is no animId number here:

I believe your script will stop there and wont get to your velocity update.

animId gets set in the remote event.

1 Like