I am trying to make a code that whenever a person presses the key e, a ball appears in front of the player. I have yet to add the velocity because I dont know how, and the CFrame from this code, I just got from youtube because i do not understand it. May anybody pls help me.
local Player = game.Players.LocalPlayer
game:GetService("UserInputService").InputBegan:connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
local x = Instance.new("Part")
x.Shape = "Ball"
x.CanCollide = false
x.TopSurface = "Smooth"
x.BottomSurface = "Smooth"
x.CFrame = Player.Character.UpperTorso.CFrame * CFrame.new(0,3,-12)
end
end)

3 comments
wait(0.5) at the start
Could you expand on what you mean? How's the player nil? What do you mean by that? Is the script your using a LocalScript? You also didn't parent your part, and I recommend you, instead of getting the torso(s), retrieve the HumanoidRootPart for that purpose; much better, and shortens code. All in all, please be more descriptive.
Whenever I try to run my script by pressing e in the game, in the output it says, "Player is a nil value", Nope, I was using a regular script in the scriptservicescript. and what do u mean by parenting my part? Also, what do you mean by getting the torsos... I was trying to position the fireball to the torso by using CFrame which I dont understand, the cframe code that I used was from a video. Al