Why can't I fire to server?

as you can see from the title, the script doesn’t let me use :FireServer() for some reason and gives me an error saying attempt to index nil with 'FireServer'.

all help is appreciated!

here’s the script:

-- services and variables
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = game.Players.LocalPlayer
local character = player.Character
local mouse = player:GetMouse()
local debounce = false
local FireBlast = script:FindFirstChild("FireBlast")

local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://8277263227"

-- code
UserInputService.InputBegan:Connect(function(input, gameprocessed)
	if gameprocessed then return end
	if input.KeyCode == Enum.KeyCode.Q then
		local animation = character.Humanoid:LoadAnimation(animation)
		debounce = true
		FireBlast:FireServer(mouse.Hit.p)
		task.wait(1.5)
		debounce = false
	end
end)

Is FireBlast a RemoteEvent? Try moving FireBlast to ReplicatedStorage if it is.

1 Like

Ensure that the FireBlast is a RemoteEvent (should not be a BindableEvent).

1 Like

On a side note, consider replacing:

With:

local FireBlast = script:WaitForChild ("FireBlast") 
2 Likes

Instead of doing :FindFirstChild("FireBlast") try using :WaitForChild("FireBlast") as that is the only way I see the script giving that error in specific unless “FireBlast” doesn’t exist or is misspelled. There may be a different solution though.