So I have a global ban script and when I try to use it on others it won't work on them, but if I test it on me it works. What's going on.

local inputPlayerName = script.Parent.Parent.Parent.InputPlayerName
local inputBanKickReason = script.Parent.Parent.InputBanKickReason

local players = game:GetService("Players")

script.Parent.MouseButton1Click:Connect(function()
	local name = inputPlayerName.Text
	local playerToBan = players:FindFirstChild(name)
	local leaderstats2 = playerToBan:FindFirstChild("leaderstats2")
	local globalBan = leaderstats2:FindFirstChild("GlobalBan")
	if playerToBan then
		globalBan.Value = true
		playerToBan:Kick(inputBanKickReason.Text)
	else
		
	end
end)