well this is my first time trying to tag a humanoid, trying to create a gauntlet that has a 50/50 chance to kill you when you snap your fingers (you know the reference), but tagging the humanoid is Very Confusing. |:<

I was wondering if I can receive help here, since I am a rookie at making scripts like these.

the main thing I want is how to get the enemies character/humanoid.

The title says efficiently because I want to know an easier way to do it without some problems

EDIT: I managed to Tag the humanoid, but it seems the "Kills Leaderboard" wont go up!


here it is:

Debris = game:GetService("Debris")
Players = game:GetService("Players")
--Character = script.Parent.Parent

function TagHumanoid(humanoid, player) -- By TakeHonorable!
	local Creator_Tag = Instance.new("ObjectValue")
	Creator_Tag.Name = "creator"
	Creator_Tag.Value = player
	Debris:AddItem(Creator_Tag, 2)
	Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
	for i, v in pairs(humanoid:GetChildren()) do
		if v:IsA("ObjectValue") and v.Name == "creator" then
			v:Destroy()
		end
	end
end

debounce = true
script.Parent.Equipped:Connect(function()
	Character = script.Parent.Parent -- stop crashing stupid gaunlet
	CharacterName = Character.Name
end)

script.Parent.Unequipped:Connect(function()
	Character.Humanoid.WalkSpeed = 16
	script.Parent.Handle['1'].Flare.Enabled = false
	script.Parent.Handle['2'].Flare.Enabled = false
	script.Parent.Handle['2'].Flare.Enabled = false
	script.Parent.Handle['3'].Flare.Enabled = false
	script.Parent.Handle['4'].Flare.Enabled = false
	script.Parent.Handle['5'].Flare.Enabled = false
	script.Parent.Handle['6'].Flare.Enabled = false
end)

	
script.Parent.onSnapped.OnServerEvent:Connect(function(player)
	--if debounce == true then
	--debounce = false
	script.Parent.Handle['1'].Flare.Enabled = true
	script.Parent.Handle['2'].Flare.Enabled = true
	script.Parent.Handle['2'].Flare.Enabled = true
	script.Parent.Handle['3'].Flare.Enabled = true
	script.Parent.Handle['4'].Flare.Enabled = true
	script.Parent.Handle['5'].Flare.Enabled = true
	script.Parent.Handle['6'].Flare.Enabled = true
	Character.Humanoid.WalkSpeed = 0
	local animationTrack1 = Character.Humanoid.Animator:LoadAnimation(script.Cast)
	animationTrack1:Play()
	animationTrack1:AdjustSpeed(.1)
	local FF = Instance.new("ForceField")
	FF.Parent = Character
	FF.Visible = false
	Debris:AddItem(FF,10)
	script.Parent.Handle.Thanos:Play()
	wait(8.4)
	Character.Humanoid.WalkSpeed = 16
	animationTrack1:Stop()
	local animationTrack = Character.Humanoid.Animator:LoadAnimation(script.Snap)
	animationTrack:Play()
	for i,v in pairs(workspace:GetChildren()) do
		if v:FindFirstChild("Humanoid") then
			local Randomiser = math.random(1,2)
			if Randomiser == 2 then
				if v.Name ~= CharacterName then  -- Main bit
					UntagHumanoid(v.Humanoid)
					TagHumanoid(v.Humanoid,script.Parent.Parent) 
					wait(.1)
					v.Humanoid:TakeDamage(v.Humanoid.MaxHealth) -- in case :BreakJoints Messes everything up!
				end
			end
		end
	end
	for i,e in pairs(game.Players:GetChildren()) do
		if e.Name ~= player.Name then
			local Gui = script.GUI:Clone()
			Gui.Parent = e.PlayerGui
			Gui.Frame.LocalScript.Disabled = false
		end
	end
	script.Parent.Handle['1'].Flare.Enabled = false
	script.Parent.Handle['2'].Flare.Enabled = false
	script.Parent.Handle['2'].Flare.Enabled = false
	script.Parent.Handle['3'].Flare.Enabled = false
	script.Parent.Handle['4'].Flare.Enabled = false
	script.Parent.Handle['5'].Flare.Enabled = false
	script.Parent.Handle['6'].Flare.Enabled = false
	--end
	--debounce = true
end)

3 comments

0

Do Not use Humanoid Tagging. You another method.

0

You could use a tagging plugin and tag the humanoid that way.

0

but i mean tagging as in if the humanoid dies then the "Kills Leaderboard" will go up