Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make a computation for each step taken by the player?

Imagine that I have a player walking by pressing and holding the forward key and I want to print "hello" every time he takes a step. How do I achieve this? I have tried :Running event but it freezes functionality and :Strafing event seems bugged!?

1 answer

Well, the way I would approach this is through the Touch event.

I ask myself, "What counts as a step?"

A step is when the feet touches the ground.

"What counts as 'the ground'?"

So then you would code the Touch event for each feet when it touches "the ground."

3 comments

0

What would you say if I want to make a print at every frame or at every key input that the model goes through?

0

I'm not quite understanding your question... I would say go for it; make the print("Hello"). Try it out with a fresh project and Baseplate as your "ground." Then play with the Touched and TouchEnded events.

0

I think you're trying to measure "distance" in which case you would use Vector3's Magnitude and count how many studs the player has moved from his last position.

This discussion is preserved as it was. New answers, comments, and votes are closed.