my object value is nil/ blank

local tool = script.Parent
local name = tool.Parent.Parent.Name
local anim = 1
local attack = true
local mid = false
local KOValue = "Kills"
local damage = 50
tool.Equipped:Connect(function()
	
	_G.player = game.Players:GetPlayerFromCharacter(tool.Parent)
	_G.Character = _G.player.Character
	_G.Character.Animate.run.RunAnim.AnimationId = "rbxassetid://8293847457"
	_G.Character.Animate.idle.Animation1.AnimationId = "rbxassetid://8316301152t"
	_G.Character.Animate.walk.WalkAnim.AnimationId = "rbxassetid://8293847457"
	_G.Character.Animate.idle.Animation2.AnimationId = "rbxassetid://8315839497"
end)
local function slice(hit)
	if mid == false then
		mid = true
		 _G.zom = hit.Parent.Name == "zombie"
		_G.zomboss = hit.Parent.Name =="zombieboss"
		if _G.zom then
			_G.zombie = hit.Parent.Zombie
			wait()
			if _G.zombie.Health > 0 then
				_G.zombie.Health -= 50
				local tag = Instance.new("ObjectValue")
				tag.Value = _G.Player
				tag.Name = "creator"
				tag.Parent = _G.zombie
				game:GetService("Debris"):AddItem(tag,5)
			end
		end	
		wait(0.4)
		mid = false
	end
end

thanks in advance.

2 comments

0

Its bad practice to use _G

0

you should write _G.player lowercase