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

IsDescentOf is not working on my fireball script?

Basically everything works fine except that I am trying to make it to where when the player creates the fireball it does not damage them, it damages the other player.

19:48:52.920 - IsDescendentOf is not a valid member of Workspace

That is the error I get and here is my script.

local player = game.Players.LocalPlayer mouse = player:GetMouse()

mouse.KeyDown:connect(function(plr)

if plr == "q" then
	print(plr)
	
	
	local bob = Instance.new("Part")
	
	bob.Parent = game.Workspace
	bob.Shape = "Ball"
	bob.TopSurface = "Smooth"
	bob.BottomSurface = "Smooth"
	bob.Anchored = false
	bob.Size = Vector3.new(5,5,5)
	bob.CanCollide = false
	bob.Transparency = .5
	bob.BrickColor = BrickColor.new("Red")
	bob.CFrame = player.Character.Torso.CFrame *CFrame.new(0,0,-20)
	
	
	
	
	local thing = Instance.new("BodyVelocity",bob)
	thing.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
	thing.velocity = player.Character.Torso.CFrame.lookVector*80
	
	
	
	
	
local chat = game:GetService("Chat")
chat:Chat(player.Character.Head, "FireBall")

	
	
	bob.Touched:connect(function(plr)
		local hum = game.Players.LocalPlayer.Character:FindFirstChild("Humanoid")
		if hum ~= nil and not bob.Parent:IsDescendentOf(script.Parent) then
			hum:TakeDamage(20)
		end
	end)
	
	
	
	
	local fire = Instance.new("Fire")
	fire.Parent = bob
	fire.Size = 10
	
	
	
	
	local thing = game:GetService("Debris")
	thing:AddItem(bob, 5)
	thing:AddItem(chat, 5)
	if player.leaderstats.Exp.Value >= 500 then
	player.leaderstats.Exp.Value = player.leaderstats.Exp.Value - 500
	else
		local game = game:GetService("Chat")
		game:Chat(player.Character.Head, "You dont have enough")
		game.Players.LocalPlayer.Backpack.LocalScript.Disabled = true
	
	end
	end

end)

1 comment

1

just saying, keydown is deprecated. It still works, but not recommended for new work. The thing that replaces it is UserInputState (IsKeyDown)

1 answer

You've misspelled the method.

The correct spelling is IsDescendantOf, ending ant not ent

3 comments

0

Ok, that fixes the error, but it does damage on me when the fireball hits another object for some reason.

0

How did you get the to the point that your code has many errors in it? Did you not test as you were writing it?

0

I did, everything works except the fact when it hits another humanoid it does damage to me and not them.

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