so the funtion fires if i walk but if i continue walking in that direction for a while it doesnt fire unless i change directions
01 | local human = script.Parent:WaitForChild( "Humanoid" ) |
02 | local debounce = false |
03 |
04 | human.Running:Connect( function () |
05 | if not debounce then |
06 | debounce = true |
07 | wait(script:WaitForChild( "Waittime" ).Value) |
08 | print ( "TEST" ) |
09 | script:WaitForChild( "Step" ):Play() |
10 | local value = Instance.new( "StringValue" , script.Parent:WaitForChild( "Torso" )) |
11 | value.Name = "Soundvalue" |
12 | game.Debris:AddItem(value, 3 ) |
13 | debounce = false |
14 | end |
15 | end ) |
humanoid.Running only fires when the WalkSpeed of the humanoid changes. try using this instead
01 | local human = script.Parent:WaitForChild( "Humanoid" ) |
02 | local debounce = false |
03 |
04 | while humanoid.MoveDirection.Magnitude > 0 do --// Checks if the HumanoidRootPart of the character is moving using the humanoid.MoveDirection |
05 | if not debounce then |
06 | debounce = true |
07 | wait(script:WaitForChild( "Waittime" ).Value) |
08 | print ( "TEST" ) |
09 | script:WaitForChild( "Step" ):Play() |
10 | local value = Instance.new( "StringValue" , script.Parent:WaitForChild( "Torso" )) |
11 | value.Name = "Soundvalue" |
12 | game.Debris:AddItem(value, 3 ) |
13 | debounce = false |
14 | end |
15 | end ) |