Hello! im making a loop where it always checks if the value of an intvalue is 10. However, this isn’t working and appears with the error. Can someone help? Idk why this is happening.
Thank you.
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
while task.wait() do
if char:FindFirstChild("HitCounter").Value == 10 then
script.Parent.BackgroundTransparency = 0
elseif char:FindFirstChild("HitCounter").Value ~= 10 then
script.Parent.BackgroundTransparency = 0.7
end
end
The program is saying: Attempt to index nil with value → Value doesn’t exist in nil → HitCounter is nil
You’re script is saying that HitCounter inside character doesn’t exist, When I got this error it was mostly because it wasn’t there yet. So try to do char:WaitForChild(“HitCounter”). If that won’t work please send script which is creating the value