#What am I doing wrong?

1 messages · Page 1 of 1 (latest)

queen nest
#

I need the cylinder part (glowberryModel) to have itself be copied and spawned on the square part (spawn) but the script I have doesn't work, what's going wrong?

#

Brand new to coding by the way so please be as simple as possible :p

wise lynxBOT
#

studio** You are now Level 1! **studio

pearl hazel
queen nest
# pearl hazel what is the purpose of "glowberry"

It doesn't really have a purpose I've just started the creation of the game. I just want to figure out how to make a copy of glowberry that will have a chance to appear on spawn every now and again before I develop it further

pearl hazel
#

sorta like a random spawn?

queen nest
#

Yeah, a random spawn on a specific point

#

Aka spawn

pearl hazel
#

only one spawn point?

queen nest
#

I'll add more later, but for now Im just trying it with this one spawn point

#

I can always just duplicate spawn and have it in several places around the map

pearl hazel
#

its not that simple lol

#

okay let me try make you something

queen nest
#

The 5 words I didn't want to hear 😭

queen nest
pearl hazel
#

any specific spawn interval?

queen nest
#

I'm confused why it's not that simple though, wouldnt each spawn have a chance at duplicating glowberry and having it spawn?

queen nest
pearl hazel
queen nest
#

Ah that makes sense actually

pearl hazel
#

what i did is i made two spawns, "glowberryspawn1" and "glowberryspawn2" so it spawns randomly between the two and only onone of them

queen nest
#

Oh cool!

pearl hazel
#

just testing

queen nest
#

If I were to add more glowberry spawns later on is that possible?

pearl hazel
#

yes i will show you how in a second

#

do you want the glowberry to get destroyed when it respawns on another spawn? or just them to pile up

queen nest
#

Id like to have them able to spawn at the same time, but not all the time

#

If you get me

pearl hazel
#

i dont understand lol

queen nest
#

Let me think of how to explain this

#

Each spawn has its own chance to spawn the glowberry for 5 minutes at a time, so multiple could spawn but none might spawn

pearl hazel
#

im saying after it spawns on another spawnpad must it stay on both spawns or get destroyed on the original spawn

queen nest
pearl hazel
#

gotcha

queen nest
#

So every 5 minutes 1 pad could spawn one, or none, or all of them

#

I hope that's a little clearer sorry

pearl hazel
#

for the sake of time im just going to make it a couple of seconds but you can change it later

queen nest
#

Yeah ofc that's fine, I was trying to do that anyways haha

wise lynxBOT
#

studio** You are now Level 2! **studio

pearl hazel
#

im just adding some comments to help

queen nest
#

You're honestly brilliant thank you so much

pearl hazel
#
--Put this script into ServerScriptService.
--Make three parts each called GlowberrySpawn1, GlowberrySpawn2, GlowberrySpawn3.
--Make a part named "Glowberry" and put it into ReplicatedStorage, the part will dissapear its normal.
--Anchor all parts so they dont roll around on the map
local replicatedStorage = game:GetService("ReplicatedStorage")
local glowberryTemplate = replicatedStorage:WaitForChild("Glowberry")

local spawnPoints = {
    workspace:WaitForChild("GlowberrySpawn1"),
    workspace:WaitForChild("GlowberrySpawn2"),
    workspace:WaitForChild("GlowberrySpawn3")
}

local spawnInterval = 12 -- Time between spawns (SECONDS)
local activeGlowberries = {} -- Track current glowberries

-- Chance to spawn at a given point (between 0 and 1), 0=none 1=always
local spawnChance = 0.5 -- 50% chance

-- Function to spawn a glowberry at a specific spawn point
local function trySpawnGlowberry(spawnPart)
    if math.random() < spawnChance then
        local glowberry = glowberryTemplate:Clone()
        glowberry.CFrame = spawnPart.CFrame
        glowberry.Parent = workspace

        table.insert(activeGlowberries, glowberry)

        -- Destroy it after 5 seconds (deletes after 5 seconds)
        task.delay(5, function()
            if glowberry and glowberry.Parent then
                glowberry:Destroy()
            end
        end)
    end
end

-- Main loop (DONT CHANGE OR IT WILL BREAK)
while true do
    wait(spawnInterval)

    -- Clear previous references
    activeGlowberries = {}

    -- Try spawning at each spawn point
    for _, spawn in pairs(spawnPoints) do
        trySpawnGlowberry(spawn)
    end
end
#

there will be a little copy button when you hover over it

#

just click that and wabam!

queen nest
#

Oh I'm on mobile haha

#

I'm fine to type it out though I have plenty of time

pearl hazel
#

roblox studio on mobile?

queen nest
#

Noooo discord

#

My laptop is annoyingly slow

pearl hazel
#

just use discord on your browser

queen nest
pearl hazel
#

you have to copy it

queen nest
#

The app made my laptop practically take off like a helicopter

pearl hazel
#

if you type it it wont work

#

due to spaces and stuff

queen nest
#

Alrighty, thanks a bunch

pearl hazel
#

let me know if you need any help

queen nest
#

Is it okay if I keep you in my dms?