Is the way I code weird?

Ignore the indenting I wrote this outside of studio but tell me if this is a bad way to code?

repeat wait() until game.Players.LocalPlayer.Character
Player = game.Players.LocalPlayer
c = Player.Character
game:GetService("UserInputService").InputBegan:Connect(function(input,isTyping)
    if isTyping then return end
    if input.KeyCode == Enum.KeyCode.E then

       end
end)
1 Like

You could remove the repeat wait() until game.Players.LocalPlayer.Character and change c = Player.Character or Player.CharacterAdded:Wait() Hope this makes the script look better.

3 Likes

Alright because I always knew repeating wait was laggy. Thanks for the new way

I recommend for aesthetic’s doing:

if not isTyping then
–code
end

In any while true do, while wait do, always add a wait or it will LAG A LOT. So, when making a loop, add a wait(), it can be empty, but it will still wait a tenth of a second, avoiding lag.

Don’t use globals, since they are slower to reference. Always localize your variables for efficiency.