Sorry about the title not being to specific. Anyway I'm trying to make a tool that when the player clicks it creates a pillar of fire the damages players and npcs. The problem is, when ever a player/NPC touches it the pillar goes over them.

I made a gif if you're having trouble understanding the problem: https://media.giphy.com/media/N9LAYWnMzDVe0/giphy.gif

Code located in the tool:

wait(1)
local tool = script.Parent
play = tool.Parent.Parent
mouse = play:GetMouse()
char = play.Character
hum = char.Humanoid
root = char.HumanoidRootPart
fire = script.Parent.fire
local on = true

tool.RemoteEvent.OnServerEvent:connect(function(play, mousehit)
	local a = hum:LoadAnimation(tool.fire_throw)
	a:Play()
	hum.WalkSpeed = 16
	root.CFrame = CFrame.new(root.Position,root.Position + Vector3.new(mousehit.lookVector.x,0,mousehit.lookVector.z))
	wait(0.7)
	fire:Play()
	local firep = tool.Handle:clone()
	firep.CFrame = char.Torso.CFrame
	firep.Transparency = 0
	firep.Orientation = Vector3.new(0,0,-90)
	firep.Parent = char.Torso
	firep.Anchored = true
	firep.CanCollide = false
	local num1 = 0.5
	local num2 = 0.5
	local num3 = 0.5
	
	for i=1,25 do --create pillar
		wait(0.01)
		num1 = num1 + 10
		num2 = num2 + 1
		num3 = num3 + 1
		firep.Size = Vector3.new(num1,num2,num3)

		firep.Touched:connect(function(hit) -- check to see if a player/NPC touches pillar
			local ehum = hit.Parent:FindFirstChild("Humanoid") or hit.Parent.Parent:FindFirstChild("Humanoid") or hit.Parent:FindFirstChild("Human")
			if ehum  and ehum ~= hum then
			ehum.WalkSpeed = 0
			ehum:TakeDamage(0.05) --damage
			wait(2)
		end
			ehum.WalkSpeed = 14
		end)
	end

	hum.WalkSpeed = 16
	game.Debris:AddItem(firep,1)	
	
	
	
	local ten = true

	firep.Touched:connect(function(hit) --while pillar is made check for player/NPC 
		if not ten then return end
		ten = false
		local ehum = hit.Parent:FindFirstChild("Humanoid") or hit.Parent.Parent:FindFirstChild("Humanoid") or hit.Parent:FindFirstChild("Human")
		if ehum  and ehum ~= hum then
			wait(2)
			ehum.WalkSpeed = 0
			ehum:TakeDamage(1)
		end
			ehum.WalkSpeed = 14
				
		wait()
		ten= true
	end)
	
end)

fire.Changed:connect(function() -- play animation (not important)
if fire.IsPlaying == true then
wait(1)
fire:Stop()
end
end)

4 comments

0

It's not a coding error, it does that. Just make it so you can't collide with that item. Maybe that will help.

0

It's weird because I have it so its set to cancollide = false, I also unchecked it.

0

Maybe try setting the parent after you anchored and made cancollide = false?

0

Still didn't work, thanks for the help I'll figure out another way.