The error comes from this line

local newFireball = fireball:Clone()


local remoteEvent = game.ReplicatedStorage:WaitForChild("FireBall")
local fireball game.ServerStorage:WaitForChild("Fireball")

remoteEvent.OnServerEvent:Connect(function(player)
	local character = player.Character
	local newFireball = fireball:Clone()
	newFireball.CFrame = character.HumanoidRootPart.CFrame

	local bodyVelocity = Instance.new("BodyVelocity")
	bodyVelocity.MaxForce = Vector3.new(5000,5000,5000)
	bodyVelocity.Velocity = (character.HumanoidRootPart.CFrame.lookVector*100)
	bodyVelocity.Parent = newFireball

	newFireball.Parent = workspace

	local touchConn

	touchConn = newFireball.Touched:Connect(function(hit)
		if hit.Parent:FindFirstChild("Humanoid") then
			if hit.Parent.Name ~= player.Name then
				hit.Parent:BreakJoints()
				if touchConn ~= nil then 
					touchConn:Disconnect()
				end
				newFireball:Destroy()
			end
		end


		
	end)
	wait(2)

	if touchConn ~= nil then touchConn:Disconnect() end
	newFireball:Destroy()
	
end)

Here is the local script if anything in there causes that error


local UIS = game:GetService("UserInputService")

local player = game.Players.LocalPlayer

local character = player.Character or player.CharacterAdded:Wait()

local mouse = player:GetMouse()
mouse.TargetFilter = character
local debounce = false

UIS.InputBegan:Connect(function(Input, IsTyping)
	if not IsTyping then
		if not debounce then
			debounce = true
			if Input.KeyCode == Enum.KeyCode.Q then
				game.ReplicatedStorage.FireBall:FireServer(mouse.Hit)
			end
			wait(0.01)
			debounce = false
		end
	end
end)

1 comment

0

Nvm I fixed the problem myself. I forgot to add an equal sign to set a variable