explore
key systems
new
docs
discord
search scripts
⌘K
explore
key systems
new
docs
discord
sign in
⌘↵
--
publishes from anywhere on this page
new paste
untitled.luau
empty
/ 512kb
open file
⌘O
explore
key systems
new
docs
sign in
save-an-egg-script-by-supernic-copy.luau
32 lines · 960 b
/ 512kb
open file
⌘O
-- EggPart -> EggSaveScript local eggPart = script.Parent local prompt = eggPart:WaitForChild("ProximityPrompt") local EGG_COST = 10 -- Price to save/hatch the egg prompt.Triggered:Connect(function(player) local leaderstats = player:FindFirstChild("leaderstats") if not leaderstats then return end local coins = leaderstats:FindFirstChild("Coins") local eggsSaved = leaderstats:FindFirstChild("EggsSaved") if coins and eggsSaved then if coins.Value >= EGG_COST then -- Deduct cost and reward player coins.Value = coins.Value - EGG_COST eggsSaved.Value = eggsSaved.Value + 1 -- Visual feedback (Egg shrinks momentarily) eggPart.Size = eggPart.Size - Vector3.new(0.5, 0.5, 0.5) task.wait(0.2) eggPart.Size = eggPart.Size + Vector3.new(0.5, 0.5, 0.5) print(player.Name .. " successfully saved an egg!") else -- Not enough coins notification/feedback warn(player.Name .. " does not have enough coins!") end end end)