Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Both players toss a coin once. If a player's result is Heads, they gain 2000 Life Points, and if their result is Tails, they take 2000 damage.
--運命の分かれ道
--The Paths of Destiny
local s,id=GetID()
function s.initial_effect(c)
	--Activate
	local e1=Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_COIN)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetTarget(s.target)
	e1:SetOperation(s.activate)
	c:RegisterEffect(e1)
end
s.toss_coin=true
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return true end
	Duel.SetOperationInfo(0,CATEGORY_COIN,nil,0,PLAYER_ALL,2)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
	local res=Duel.TossCoin(tp,1)
	if res==COIN_HEADS then Duel.Recover(tp,2000,REASON_EFFECT)
	elseif res==COIN_TAILS then Duel.Damage(tp,2000,REASON_EFFECT) end
	res=Duel.TossCoin(1-tp,1)
	if res==COIN_HEADS then Duel.Recover(1-tp,2000,REASON_EFFECT)
	elseif res==COIN_TAILS then Duel.Damage(1-tp,2000,REASON_EFFECT) end
end