I have a LocalScript inside the player(s), which records if a player presses, and releases a certain key, which in this case, is Z. Pressing the key fires the GomuPistolEvent and KeyHeld = true, releasing the key fires the GomuPistolEvent and KeyHeld = false. The GomuPistolEvent creates a part, welds that part, and has a while loop that increases its size, changes its position, and re welds that part back to the player. This gives it the appearance that the player's arm is "stretching" since its welded to the player's arm. My problem is that after the part reaches a certain size, the player starts flying around everywhere. What could this possibly be?

GIF: https://gyazo.com/a2eb62e496412ea02b15abf78f6aaca5

Code:

function ReachingKeyframe(Keyframe)
		if Keyframe == 'Pistol' then
			GomuPistolAnimTrack:AdjustSpeed(0)
			print('pistol')
			Humanoid.WalkSpeed = 0
			Damage = true
			ArmStretch.Name = 'ArmStretchRight'
			ArmStretch.Size = RightArm.Size
			ArmStretch.Position = RightArm.Position
			ArmStretch.Anchored = false
			ArmStretch.CanCollide = false
			ArmStretch.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0, 0, 0)
			ArmStretch.TopSurface = 0
			ArmStretch.BottomSurface = 0
			ArmStretch.Color = RightArm.Color
			ArmStretch.Parent = Character
			Weld(ArmStretch, RightArm, CFrame.new(0, 0, 0) * CFrame.new(0, 0, 0))
			RightArm.Transparency = 1
			RightHand.Transparency = 1
			GomuStretchSndFX.Playing = true
			GomuStretchSndFX.Parent = RightArm
			while Keyframe == 'Pistol' do
				ArmStretch.Size = ArmStretch.Size + Vector3.new(0, 1, 0)
				ArmStretch.Position = ArmStretch.Position + Vector3.new(0, 0.5, 0)
				Weld(ArmStretch, RightArm, CFrame.new(0, ArmStretch.Size.Y / 2, 0))
				wait()
			end
			GomuPistolAnimTrack:AdjustSpeed(1)
			Humanoid.WalkSpeed = 16
		end
	end

2 comments

0

Probably a welding problem, check if the parts have collisions, anchoring etc.

0

The parts involved are the players arm, and the "ArmStretch" part that is assigned its properties above, so there is nothing anchored nor collision.