Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My game keeps crashing when this loop is ran by pressing E? Please help!

Asked by 5 years ago

Hello, A piece of code of mine is constantly crashing, so how would I prevent that? Any help is greatly appreciated.

local UIS = game:GetService("UserInputService") local NameofBooleanHere = false UIS.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.E then NameofBooleanHere = true wait(0.1) repeat until not NameofBooleanHere wait(0.1) Player.Character.Humanoid:LoadAnimation(aim):Play() meleeing = false tool.GripForward = Vector3.new(-0.1, 0, -0.9) tool.GripRight = Vector3.new(0.9, 0, -0.1) aiming = false end end) How do I make this NOT crash?

Thanks, Rook.

1 answer

Log in to vote
0
Answered by
Fifkee 2017 Community Moderator Moderation Voter
5 years ago

repeat until not is bad

use repeat wait() until not

it has the same concept of while true do, if there is no wait()/thread yielding function, it will crash

Ad

Answer this question