local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remote = ReplicatedStorage:WaitForChild("BuyEggEvent")
remote.OnServerEvent:Connect(function(player)
--common egg script
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local wins = leaderstats:FindFirstChild("Wins")
print(wins)
if wins then
print("wins : ", wins.Value)
if wins.Value >= 10 then
wins.Value = wins.Value - 10
print(player, "has bought a common egg")
else
print(player, "has not enough wins")
end
end
end
end)
--uncommmonEgg script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remote = ReplicatedStorage:WaitForChild("BuyEggEvent")
remote.OnServerEvent:Connect(function(player)
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local wins = leaderstats:FindFirstChild("Wins")
print(wins)
if wins then
print("wins : ", wins.Value)
if wins.Value >= 50 then
wins.Value = wins.Value - 50
print(player, "has bought a uncommon egg")
else
print(player, "has not enough wins for uncommon egg !")
end
end
end
end)
** You are now Level 10! **
