I want to make an Egg Hunt Practice game, but I don't know how to script. I tried making a script, but of course it dosen't work. Could anyone help me make a script which spawns eggs (without cloning itself while it's there) A points leader board (when you touch an egg you get points).
Here's what I tried to do, to make it spawn an egg.
while true do wait(20) BeastEgg=game.Lighting.BeastEgg:Clone() BeastEgg.Parent=game.Workpace.BeastEggSpawn wait(40) BeastEgg.Script0.Disabled=false end
And Script0 is inside of the egg.
script.Parent:Remove()
Thanks!
Egg spawn code:
local eggs = {game.Lighting.BeastEgg:Clone(),game.Lighting.EasyEgg:Clone(),game.Lighting.NormalEgg:Clone()} for _, egg in pairs(eggs) do egg.Position = Vector3.new(math.Random(1,100),math.Random(1,2),math.Random(1,100)) end -- You can make the position differ for a certain egg with an "if" statement.
Points Leaderboard:
local leaderboard = Instance.new("IntValue") local points = Instance.new("IntValue") game.Players.PlayerAdded(function(player) points.Name = "Points" leaderboard.Name = "leaderstats" leaderboard.Parent = player points.Parent = leaderboard end)
Put this script inside every egg! IT gives players points, and if you add extra scripts and an inventory gui, it can give the people their eggs!
local egg = script.Parent egg.Touched:connect(function(part) local g = game.Players:GetPlayerFromCharacter(part.Parent) if part:IsA("Part") and (g) then local f = g:findFirstChild("leaderstats") local n = f:FindFirstChild("Points") n.Value = n.Value + 1 egg:remove() end end)
Pm me for more help, and don't forget to give me some reputation by click the up arrow next to my name over here: ---------------------------------->