Recently I’ve been trying to check if a player has a certain BoolValue attached to it, if it doesn’t then it’ll create one. But it’s only returning nil values and not creating a value parented to the person. I’ve tried a lot of “solutions” but none of them work.
code: (serverside)
PlayerKilledByZombie.Event:Connect(function(Name)
if Name:GetChildren("IsZombie") == nil then
local IsZombie = Instance.new("BoolValue")
IsZombie.Parent = Name
IsZombie.Value = false
IsZombie.Name = "IsZombie"
ChangePlayerIntoZombieKilled:Fire(Name)
end
end)
check if the player has a value named IsZombie, if they dont it creates IsZombie parented to the player so they can attack when they turn into a zombie.
PlayerKilledByZombie.Event:Connect(function(Name)
if Name:FindFirstChild("IsZombie") == nil then
local IsZombie = Instance.new("BoolValue")
IsZombie.Parent = Name
IsZombie.Value = false
IsZombie.Name = "IsZombie"
ChangePlayerIntoZombieKilled:Fire(Name)
end
Instance.new("BoolValue", Name)
end)
the name is what’s sent from another server script
if RayHitBox.Instance.Parent.Humanoid.Health <= 0 then
local PlayerKilledByZombie = script.Parent.PlayerKilledByZombie
PlayerKilledByZombie:Fire(Name)
end