So I'm trying to get it so when the player stops moving, they can regain control of their player and continue actions fluidly, I tried doing repeat wait() until character.Humanoid.Running == false
but for obvious reasons, that didn't work
repeat wait() until game.Players.LocalPlayer.Character local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:wait() local torso = character.Torso local walls = game.Workspace.Walls:GetChildren() function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.E then local lowest = 20 local low local mag for _, wall in pairs(walls) do local distance = (torso.Position - wall.Position).magnitude mag = distance if distance < lowest then lowest = distance low = wall end end print(low) if low then local ray = Ray.new(torso.Position, (low.Position - torso.Position).unit * 999) local hit, position = game.Workspace:FindPartOnRay(ray, character) local distance = (position - torso.Position).magnitude local rayPart = Instance.new("Part", player.Character) rayPart.Name = "RayPart" rayPart.BrickColor = BrickColor.new("White") rayPart.Transparency = 0.5 rayPart.Anchored = true rayPart.CanCollide = false rayPart.TopSurface = Enum.SurfaceType.Smooth rayPart.BottomSurface = Enum.SurfaceType.Smooth rayPart.formFactor = Enum.FormFactor.Custom rayPart.Size = Vector3.new(0.2, 0.2, distance) rayPart.CFrame = CFrame.new(position, torso.Position) * CFrame.new(0, 0, -distance/2) coroutine.wrap(function() wait(.5) rayPart:Destroy() end)() --here is where I need help player.PlayerScripts.ControlScript.Disabled = true player.Character.Humanoid.WalkToPoint = position player.Character.Humanoid.WalkSpeed = 23 repeat wait() until character.Humanoid.Running == false player.Character.Humanoid.WalkSpeed = 16 player.PlayerScripts.ControlScript.Disabled = false -- end end end game:GetService("UserInputService").InputBegan:connect(onKeyPress)
Nownow little normie, let me tell you a little story.
there once was a little boy, his name was nibzor. his TV provider went down, so he went to play roblox. When he was playing a gun game, it broke because the running event was supposed to return a bool value, but it returned a double. the boy got so mad, he broke his computer then went to rob a bank. Do we all see the lesson in this? Don't use cable switch to Direct TV.
Anyways, let me tell you the problem. The Running event doesn't return a bool value of if it is running or not. It returns a double of the speed at which it is running. So now you're probably sitting there.. waiting for me to provide a real answer. Ok, fine.
We can check if the speed is higher then a certain number. A player's speed isn't always 16, y'know. It has to accellerate. So to get it's exact value, we return the number in the Running event. So since this number should be somewhere between 1 and 17, We'll check if it's lower then.. For say.. 2.
repeat wait() until character.Humanoid.Running() < 2