Search code examples
luaroblox

How to create script for roblox studio? (footbal game)


How to create a script in which when you press a key, for example "e", shoot the soccer ball. If it's not difficult for you, can you write how to make the animation of raising the leg on impact?)

Vector3 dont work.(


Solution

  • You need to use the UserInputService. First create a LocalScript in StarterPlayerScripts, which is in the StarterPlayer folder visible to the explorer. And type this.

    local UserInputService = game.UserInputService 
    
    function Press()
    if UserInputService.KeyCode = Enum.KeyCode.E then
      —type in the things you want it to do after clicking E
        end
    end
    
    UserInputService.InputBegin:Connect(Press)