If Statement not working despite both conditions being the same

local sellpart = script.Parent
local replicated = game:GetService("ReplicatedStorage")

sellpart.Touched:Connect(function(part)
	if part:IsA("Part") then
		local list = part:GetTags(1)
		local playerID = list[1]
		local Players = game.Players:GetPlayers()
		for _, v in Players do
			print(v.UserId)
			print(playerID)
			if v.UserId == playerID then
				print("Event Fired")
				replicated.Sold:Fire(v)
			end
		end
	else
		print("not a part")
	end
end)

the print(v.UserId) and print(playerID) both give the exact same value, so why doesnt the if statement work?

this is a script inside a part in workspace

Tags are strings, not numbers. Also, GetTags doesn’t take any arguments so that 1 is useless.

if tostring(v.UserId) == playerID then

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