✓ Accepted answer
Player has a method called Kick for kicking the player off the server, with an optional parameter for what message to show them. The NumberValue class, as well as some of the other ones such as StringValue, also have an event that fires for whenever the value is changed called Changed. Given this information, all that needs to be done is check if the value is less than or equal to 0 in a function connected to the Changed event, and then call the kick method on every player if it is.
local Players = game:GetService("Players")
game.Workspace.Wall.NumberValue.Changed:Connect(function(value)
if value <= 0 then
local players = Players:GetPlayers()
for i, player in ipairs(players) do
player:Kick("get out")
end
end
end)
2 comments
"connect" has been depreciated. Use "Connect" instead.
is depreciated*