- What do you want to achieve?
When a remoteEvent is fired the server clones a random ducky and puts it into workspace
but when you have a lot of duckys the clone dosent appear in roblox
- What is the issue?
When there is more ducks that already spawned. When it trys to clone the duck it dosent appear in workspace? Am i doing something wrong here? I want duplicated ducks to appear in the pool
- What solutions have you tried so far?
I tried looking everywhere but i cant seem to find a solution for this
local repStorage = game:GetService("ReplicatedStorage")
local events = repStorage:FindFirstChild("Events")
local badgeservice = game:GetService("BadgeService")
local id = 2132521717
local ducks = repStorage:FindFirstChild("Ducks")
local SpecialDucks = repStorage:FindFirstChild("SpecialDucks")
local DucksToSpawn = ducks:GetChildren()
local SpawnDuck = events:FindFirstChild("SpawnDuck")
SpawnDuck.OnServerEvent:Connect(function(player)
local rng = math.random(1,100)
print(rng)
local duck = DucksToSpawn[math.random(1,#DucksToSpawn)]
duck:Clone()
duck.Parent = workspace
if rng == 100 then
badgeservice:AwardBadge(player.UserId,id)
local duckyspecial = SpecialDucks.GoldenDucky:Clone()
duckyspecial.Parent = workspace.Ducks
end
end)
Any help is apreciated!