isnt a thing there is if (code) then, do is for for (code) do.
basically if (code) then does a thing if the (code) is correct or not
for (code) do is in simple terms doing something for everything in that code
some examples:
-- if the player has less than 50 health heal him
local player = game:GetService("Players").Localplayer
if player.Character.Humanoid.Health <= 50 then -- <= 50 meaning 50 or lower
player.Character.Humanoid.Health = 100
end
-- kill all players
local players = game.Players:GetPlayers()
for i,v in pairs(players) do
v.Character.Health = 0
end
these are just basic examples though
for code():connect though it can be used for mutliple things mostly for functions though for example:
-- do something when a remoteevent is triggered
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function()
for i,v in pairs(game.Players:GetPlayers()) do
v.Character.Humanoid.Health = 0
end
end)
-- kills all players when remoteevent is triggered