Positions not updating in OOP style module

I’m trying to make a fart mechanic where if a player presses G they will fart and create a hitbox in a singular direction that can damage players.

The issue is, I’m positioning the hitbox right in front of the player but just so that it is inside of the character where the character will gradually fart their way towards the other end of the hitbox.

I would know when the character has touched the other end of the hitbox using an attachment and a repeat loop checking the magnitude of the root position and the attachment position.

The problem is, when I try to check for the magnitude between the attachment and root, the magnitude doesn’t change even though I am moving. I assume this is because the positions aren’t changing as well.

function Fart:Wait()
	repeat
		if (self.AlignPosition.Position - self.AlignPosition.Attachment0.WorldPosition).Magnitude < .25 then
			self.Stop = true
		end
		task.wait()
	until self.Stop == true
end

In the function provided you can see I’m using this as a wait to check for when the player has touched a certain region of the hitbox.

Nevermind I just had to use what I had actually assigned for the AlignPosition values because they aren’t updating but the values assigned do change.

I exchanged each position for the attachment and root’s position instead.

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