so i was watching a YouTube video on how to make a Fireball shoot out but it shot out and forward from your torso, so i tried to edit it and make it shoot at the mouse position as this
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local RemoteEvent = game.Workspace.Fired
local UIS = game:GetService("UserInputService")
local Debounce = false
Mouse.Button1Down:Connect(function()
if Debounce == true then return end
RemoteEvent:FireServer(Debounce)
end)
That's my FireBall script in my StarterPack
and this is my FireBall Event Script
game.Workspace.Fired.OnServerEvent:Connect(function(Player, Debounce)
local Character = Player.Character or Player.CharacterAdded:wait()
Debounce = true
local Mouse = Player:GetMouse()
local mH = Mouse.Hit
local Fireball = Instance.new('Part')
Fireball.Shape = Enum.PartType.Ball
Fireball.BrickColor = BrickColor.new('Deep orange')
Fireball.Transparency = '0.5'
Fireball.Size = Vector3.new(2,2,2)
Fireball.CanCollide = false
Fireball.Material = Enum.Material.Neon
Fireball.Parent = Character
Fireball.CFrame = Character.Torso.CFrame*CFrame.new(0,1,-6)
local BV = Instance.new("BodyVelocity")
BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BV.Velocity = Character.mH.p.CFrame.lookVector*100
BV.Parent = Fireball
wait(2)
Debounce = false
Fireball:Destroy()
end)
could you please help me to find why this error shows up
11:29:06.292 - Workspace.Fired Event:5: attempt to index local 'Mouse' (a nil value)
11:29:06.293 - Stack Begin
11:29:06.295 - Script 'Workspace.Fired Event', Line 5
11:29:06.296 - Stack End
I Also have a Fired RemoteEvent in my workspace
ps: im learning to code lua and a game with my friend from watching tutorials and getting to know what specific stuff does, and with things like this. iv'e never asked a question until now but is that a good way to learn to code or should i try a different approach

3 comments
https://forum.scriptinghelpers.org/topic/911/how-to-format-questions-answers-on-the-main-site-2
That's what i did?..
You used blockquotes to format the code. I've edited your question to format the code in a code block. It is expected that you do this yourself next time.