Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Help with my magicsphere?

My magicsphere is supposed to fire out a lot of spheres and then if a player touches the sphere they die.This is the script

Player = game.Players.LocalPlayer
LazerSphear = script.Parent
Mana = 10
mouse = Player:GetMouse()
function Magic()
	Mana = Mana -0.6
	for MagicAffects = 1,20 do
		script.Parent.Handle:Clone()
		if script.Parent.Handle:FindFirstChild("Humanoid") ~= nil and Humanoid.Health not == 0 then
			Humanoid.Health = 0
		end
	end
end

3 comments

0

Is this the whole script? What calls Magic?

3

Line 9: Attempt to call 'Humanoid' (a nil value) Line 10: Attempt to call 'Humanoid' (a nil value)

1

This is the whole script BlueTaslem.I forgot to call the function

1 answer

You never assigned the variable "Humanoid" to anything. You could do

local Humanoid = script.Parent.Handle:FindFirstChild("Humanoid")
if Humanoid and Humanoid.Health ~= 0 then
Humanoid.Health = 0
end

This discussion is preserved as it was. New answers, comments, and votes are closed.