Hey! I’m trying to make a warning system but I couldn’t check if the value is there or not.
local Players = game:GetService("Players")
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Warn1 = Instance.new("IntValue")
Warn1.Name = "WarnCount"
Warn1.Value = 0
local Warn2 = Instance.new("StringValue")
Warn2.Name = "WarnReason"
Warn1.Parent = Character
Warn2.Parent = Character
while true do
if not Character:FindFirstChild("Warn1") or not Character:FindFirstChild("Warn2") then
Player:Kick("Something went wrong.")
break
end
end
end)
end)
Based on your script, it seems that you are trying to kick players for not having the values.
This will not kick the player because it will always ensure that they have the values.
game.Players.PlayerAdded:Connect(function(Player)
local Warn1 = Instance.new("IntValue", Player)
local Warn2 = Instance.new("StringValue", Player)
Warn1.Name = "WarnCount"
Warn2.Name = "WarnReason"
end)