So Uhh I made A Creator Value To My Sword Script But The Creator Tag Line Does Not work Somehow? Here Is The Full Script:

local tool = script.Parent
Players = game:GetService('Players')

local idleAnim = script:WaitForChild("Idle")
local idleAnimTrack
local swingAnim = script:WaitForChild("Swing")
local swingAnimTrack
local Debris = game:GetService("Debris")

local slashSound = script:WaitForChild("SlashSound")
local sheathSound = script:WaitForChild("SheathSound")
local hitSound = script:WaitForChild("HitSound")

local hitCharacters = {}
local debounce = false

tool.Equipped:Connect(function()
	
	local humanoid = script.Parent.Parent.Humanoid
	if not idleAnimTrack then idleAnimTrack = humanoid:LoadAnimation(idleAnim) end
	
	idleAnimTrack:Play()
	
	sheathSound:Play()
end)
tool.Unequipped:Connect(function()
	
	if idleAnimTrack then idleAnimTrack:Stop() end
	if swingAnimTrack then swingAnimTrack:Stop() end
	
	sheathSound:Play()
end)
tool.Activated:Connect(function()
	
	if debounce then return end
	debounce = true
		
	local humanoid = script.Parent.Parent.Humanoid
	if not swingAnimTrack then swingAnimTrack = humanoid:LoadAnimation(swingAnim) end
	
	swingAnimTrack:Play()
	
	wait(0.5)	
	slashSound:Play()
	
	wait(0.5)
	debounce = false
end)

function TagHumanoid(humanoid, player)
 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
tool.Blade.Touched:Connect(function(touch)
	
	if hitCharacters[touch.Parent] or not debounce then return end
	if touch.Parent:FindFirstChild("Humanoid") then
		
		if touch.Name == "Head" then
			touch.Parent.Humanoid:TakeDamage(100)
		else
			touch.Parent.Humanoid:TakeDamage(50)
		end
		hitSound:Play()
		hitCharacters[touch.Parent] = true
		wait(1)
		hitCharacters[touch.Parent] = nil
	end
end)

Is There Any way To fix this Please Help If I Cant Msg You Back That Quickly Then please Check Again Cuz I Cant always Be Available But I Will Check This As soon As posiible Thank You so much!

4 comments

0

to get a tag you need to get collectionservice i dont see it anywere in this scriopt

0

how to get the collectionservicice tho? im very sorry im just new to roblox studio

0

ok i know now tnx

0

what do i do next tho? ThankYou!!