Fireball wont show up

Im trying to create a part in the humanoid root part of a character but it wont show up. No errors in the output. Script is inside a tool.

local tool = script.Parent
local player = game.Players.LocalPlayer
local root = player:FindFirstChild('HumanoidRootPart')
function OnActivation()
	print('Activation works')
	local ball = Instance.new("Part")
	ball.Shape = Enum.PartType.Ball
	ball.Color = Color3.new(1, 0.333333, 0)
	local fire = Instance.new("Fire")
	fire.Parent = ball
	ball.Parent = root

end





tool.Activated:Connect(OnActivation)

Try changing this to:

local root = player.Character:FindFirstChild("HumanoidRootPart")

Didnt work. Just giving the whole trying to index nil with findfirstchild thing in the output.

Maybe try doing this:

local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local root = character:WaitForChild("HumanoidRootPart")

Also, Is the tool inside StarterPack?

yep yep yeppty yep


Now im getting

Players.trueblockhead101.Backpack.Tool.Fire:19: attempt to index nil with ‘Activated’

that means that the tool doesn’t exist bruh

Hmmmm, Strange, Is the script a LocalScript or a regular Script?

ok ok no need to get feisty, I can ensure that the tool is real.

local script, chap.


hey bro show me the explorer then

here ya go.
Screenshot (431)

that’s because you’re looking for the humanoidrootpart in the player, not the character. The player and the character and very different so try changing it to this:

local tool = script.Parent
local player = game.Players.LocalPlayer
local character = player.Character
local character:FindFirstChild("HumanoidRootPart")

function OnActivation()
	print('Activation works')
	local ball = Instance.new("Part")
	ball.Shape = Enum.PartType.Ball
	ball.Color = Color3.new(1, 0.333333, 0)
	local fire = Instance.new("Fire")
	fire.Parent = ball
	ball.Parent = root

end





tool.Activated:Connect(OnActivation)

little tip, having your fireball in the replicated storage and just cloning it and parenting it to the workspace would make life a bit easier and shortens your code

Though isnt this the same thing? or am i mistaken.

local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local root = character:WaitForChild("HumanoidRootPart")
function OnActivation()
	print('Activation works')
	local ball = Instance.new("Part")
	ball.Shape = Enum.PartType.Ball
	ball.Color = Color3.new(1, 0.333333, 0)
	local fire = Instance.new("Fire")
	fire.Parent = ball
	ball.Parent = root

end





tool.Activated:Connect(OnActivation)

it is, which is why it’s weird that it’s not working.

Yes, fascinating isnt it?


are there any errors? anything in the output?

Yes there is one

Players.trueblockhead101.Backpack.Tool.Fire:19: attempt to index nil with ‘Activated’

it’s because you did not define the variable “tool” yet.

I’ve messed around with it for a bit and in an empty baseplate I was able to fix the problem.

here’s the code I used:

local tool = script.Parent.Parent
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local root = character:WaitForChild("HumanoidRootPart")
function OnActivation()
	
	print('Activation works')
	local ball = Instance.new("Part")
	ball.Shape = Enum.PartType.Ball
	ball.Color = Color3.new(1, 0.333333, 0)
	local fire = Instance.new("Fire")
	fire.Parent = ball
	ball.Parent = root

end

tool.Activated:Connect(OnActivation)

pretty sure the flaw was that you defined tool as script.Parent but script.Parent is the handle, not the tool itself. could also be the fact that you don’t have a handle, not sure about that one

i’ll leave adding the body velocity and the rest of the fireball script to you :slight_smile: