This problem happens from time to time. But this time, when I looked in the developer's console in-game, it said character was a nil value. It works fine in studio however. Here's the script :
player = game.Players.LocalPlayer
char = game.Players.LocalPlayer.Character
hum = game.Players.LocalPlayer.Character.Humanoid
mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:Connect(function(key)
key = key:lower()
if key == "e" then
local fb = game:GetService("ServerStorage").Fireball:Clone()
game:GetService("Chat"):Chat(char.Head, "Fireball!", "Red")
fb.Parent = game.Workspace
fb.Anchored = true
if char.UpperTorso and char.LowerTorso then fb.CFrame = char.UpperTorso.CFrame + Vector3.new(0, 0, -2)
else
fb.CFrame = char.Torso.CFrame + Vector3.new(0, 0, -2)
end
end
end)

3 comments
https://scriptinghelpers.org/blog/it-works-in-studio-but-not-online --Read up on that.
stop spamming, noob
@antonio6643 .-. i dont think its a client whatever crap people keep saying i think its probably the character thing