My problem with TagHumanoid

Alright so I made a quest system using TagHumanoid, if you are not familiar with TagHumanoid, I used this as reference. How do I confirm a kill consistently?

So theres a problem. My TagHumanoid doesn’t tag the enemy. Usually when the enemy is tagged, it would do this
https://gyazo.com/6a2bd54bd8d0b26ef70baba32656a81d
(it will show a reward UI)

But the problem is that the new skill that I made doesn’t show the UI means the enemy is somehow not tagged.
https://gyazo.com/27966b07709a78d1f037b607c1a4aab5
(This script is made following the Lightning module tutorial from youtube.)

I just want to know if theres any mistake that I made or is there supposed to be something that wasn’t supposed to be there.

Here is the ServerScript because I believe nothing is wrong with the local script since its just an input.

function TagHumanoid(humanoid, player)
	local creator_tag = Instance.new("ObjectValue")
	creator_tag.Value = player
	creator_tag.Name = "creator"
	creator_tag.Parent = humanoid
end

function UntagHumanoid(humanoid)
	if humanoid ~= nil then
		local tag = humanoid:findFirstChild("creator")
		if tag ~= nil then
			tag.Parent = nil
		end
	end
end

local FxRemote = game.ReplicatedStorage:WaitForChild("FxRemote2")

_G.Lightning = {}

script.Parent.OnServerEvent:Connect(function(plr,direction,mouseaim)
	local Char = plr.Character
	local humRP = Char.HumanoidRootPart
	
	local SavedData = false
	for i,Users in pairs(_G.Lightning) do
		if i == plr.Name then
			SavedData = true
		end
	end
	if SavedData == false then
		_G.Lightning[plr.Name] = {false}
	end
	
	Char.RightHand.EFhand:Destroy()
	
	if _G.Lightning[plr.Name][1] == false then
		_G.Lightning[plr.Name][1] = true
		
		delay(2,function()
			_G.Lightning[plr.Name][1] = false
		end)
		
		FxRemote:FireClient(plr,Char,"Lightning")
		
		for i,v in pairs(game.Workspace:GetDescendants()) do
			if v.Name == "HumanoidRootPart" and v:IsA("BasePart") and v.Parent ~= Char then
				local EhumRP = v
				if (humRP.Position - EhumRP.Position).Magnitude < 20 then
					local Facing = humRP.CFrame.lookVector
					local Vector = (v.Position - humRP.Position).unit
					
					local Angle = math.acos(Facing:Dot(Vector))
					
					if Angle <= .6 then
						
						local EHum = v.Parent:FindFirstChild("Humanoid")
						local Number = 0
						repeat
							Number = Number + 1
							local VCharacter = game.Workspace:FindFirstChild(plr.Name)
							local vPlayer = game.Players:GetPlayerFromCharacter(VCharacter)
							TagHumanoid(EHum, vPlayer)
							EHum:TakeDamage(25 + plr.Data.DevilFruit.Value)
							UntagHumanoid(EHum)
							local HitEF = game.ServerStorage.Goro.GoroEffect:Clone()
							HitEF.Parent = EhumRP.Parent.LowerTorso
							wait(0.5)
							for i = 1,10 do
								wait(0.2)
								TagHumanoid(EHum, vPlayer)
								local Damage = 1
								EHum:TakeDamage(Damage)
								EHum.WalkSpeed = 4
							end
							EHum.WalkSpeed = 16
							HitEF:Destroy()
							UntagHumanoid(EHum)
							wait(0.1)
						until Number >= 15
					end
				end
			end
		end
	end
end)```

It would really help, thanks!

Better to destroy the tag:

tag:Destroy()
1 Like

Still the same problem, nothing really changed.

Have you thrown any breakpoints in when the desires affect takes action and looked into the Humanoid to see if the Tag exists?

Also, when you draw the UI. Are you waiting until the Tag is created?
Your UI code could be firing before the server creates it.

Could u print this val?

local vPlayer = game.Players:GetPlayerFromCharacter(VCharacter)

Yes the tag does exist in the enemy’s Humanoid. But I’m not really sure about “waiting until the tag is created”.

like adding
print(“vPlayer”) underneath?

This looks like the old tagging system which has been around forever, commonly found in some of Roblox gears.

You can’t just expect it to work with stuff it isn’t made for, in this case a lightning module you found from YouTube.

Before I updated a lot of things in my game, this script used to work. The tag humanoid works fine. But now it doesn’t work anymore.