FindFirstChild not working

I have this code:

			local WinnerValue = ReplicatedStorage.Wins:FindFirstChild('Winner.Name')
			
			if WinnerValue == nil then
				WinnerValue = Instance.new('IntValue')
				WinnerValue.Name = Winner.Name
				WinnerValue.Parent = ReplicatedStorage.Wins
			end

			WinnerValue.Value += 1

What i expect to happen is that it creates an intvalue of the name only if one doesnt already exist. What actually happens is that it will create an intvalue reguardless on if one exists already or not because WinnerValue always equals nil even if there is a child with that name.

Screenshot of the issue:

2 Likes

You are passing the string "Winner.Name" to FindFirstChild, but you probably want to pass Winner.Name instead.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.