#Coins spawning

1 messages · Page 1 of 1 (latest)

grim galleon
#

I've tried to work on coins spawning for 5 hours and nothing has worked. I want 3 coins to spawn every 5s and despawn ever 60s. Maximum amount of coins 100. I also want them to spawn just on a platform. I really need help

golden flameBOT
#

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

tawdry badge
#

5 hours

#

okay

#

send code

grim galleon
#

local ReplicatedStorage = game:GetService("ReplicatedStorage")

-- Force slow loading
task.wait(2)

-- Try multiple times to find folder
local coinFolder
repeat
coinFolder = ReplicatedStorage:FindFirstChild("CoinFolder")
task.wait(0.2)
until coinFolder

-- Try multiple times to find template
local coinTemplate
repeat
coinTemplate = coinFolder:FindFirstChild("CoinTemplate")
task.wait(0.2)
until coinTemplate

print("Coin system loaded successfully!")

local spawnArea = workspace
local maxCoins = 50
local spawnInterval = 5

while true do
if #spawnArea:GetChildren() < maxCoins then
local coin = coinTemplate:Clone()
coin.Parent = spawnArea

    -- Make sure your coin has a PrimaryPart
    coin:SetPrimaryPartCFrame(
    CFrame.new(
    math.random(-50, 50),
    5,
    math.random(-50, 50)
    )
    )
end

task.wait(spawnInterval)

end

I'm a complete noob my friend helped me out a bit

tawdry badge
#

dud

#

use

#

I mean

#

Try

#

:PivotTo

#

Instead of

#

:SetPrimaryPartCFrame

#

I mean just leave the ( ) things

tawdry badge
grim galleon
#

Nothing happened

indigo jetty
#

You shouldn’t use chat gpt if you don’t have the capability to fix its problems

tawdry badge
#

i don’t find any issue bro

#

Can you show your workspace

#

i mean

#

Explorer

indigo jetty
#

Well spawn area is workspace and if there’s more than 50 things in workspace it just doesn’t work

grim galleon
tawdry badge
#

Yeah

#

Just do it

#

there’s explorer

#

On

#

Right

#

I thinkl

#

(Cuz i never tried using it)

grim galleon
#

Yeah there is

tawdry badge
#

Show

grim galleon
#

I barely have a clue on what I'm doing so

tawdry badge
#

i mean

#

Where the script is?

grim galleon
#

In ServerScriptService

tawdry badge
#

well wait

#

So does

#

If you run the game

#

Doe it print coin system loaded

grim galleon
#

How do Ik

tawdry badge
#

dude

#

Did you even

#

Run the game

grim galleon
#

Im running it rn

golden flameBOT
#

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

tawdry badge
#

So

#

On console

#

Does it print

#

It or

#

No

grim galleon
#

Explain 😬

tawdry badge
#

Wait

#

Yeah i see the problem

grim galleon
#

The problem is me ✌️

tawdry badge
#

Replace the

#

ReplicatedStorage to

#

workspace

grim galleon
#

Move it into workspace?

tawdry badge
#

what

#

Wait

#

No

#

Just

#

Replace the word

tawdry badge
grim galleon
#

You want me to put that into the coin script?

tawdry badge
#

no

#

I mean

#

Edit your script

#

dude

#

JUST

tawdry badge
#

This is part of your script

#

all you have to do is

#

find this part and

#

Replace “ReplicatedStorage” to

#

“workspace”

grim galleon
#

K

indigo jetty
#

local ReplicatedStorage = game:GetService("ReplicatedStorage")

-- Force slow loading
task.wait(2)

-- Try multiple times to find folder
local coinFolder
repeat
coinFolder = workspace:FindFirstChild("CoinFolder")
task.wait(0.2)
until coinFolder

-- Try multiple times to find template
local coinTemplate
repeat
coinTemplate = coinFolder:FindFirstChild("CoinTemplate")
task.wait(0.2)
until coinTemplate

print("Coin system loaded successfully!")

local spawnArea = workspace
local maxCoins = 50
local spawnInterval = 5

while true do
if #coinfolder:GetChildren() < maxCoins then
local coin = coinTemplate:Clone()
coin.Parent = coinfolder

    -- Make sure your coin has a PrimaryPart
    coin:SetPrimaryPartCFrame(
    CFrame.new(
    math.random(-50, 50),
    5,
    math.random(-50, 50)
    )
    )
end

task.wait(spawnInterval)

end

I'm a complete noob my friend helped me out a bit

#

Try this

grim galleon
#

Did you just copy paste my script?

tawdry badge
#

yes

#

He

#

fixed your script

grim galleon
#

He fixed it or did he just copy paste

tawdry badge
#

FIXED

grim galleon
#

Oh

#

So nothing is happening I think it's on me

#

The script is multiplying the ReplicatedStorage coin or the one in workspace

tawdry badge
#

Oh

#

u never showed me your replicated storage

grim galleon
random parrot
#

@grim galleon whats ur current code rn

grim galleon
# random parrot <@1365574183404306464> whats ur current code rn

local ReplicatedStorage = game:GetService("ReplicatedStorage")

-- Force slow loading
task.wait(2)

-- Try multiple times to find folder
local coinFolder
repeat
coinFolder = workspace:FindFirstChild("CoinFolder")
task.wait(0.2)
until coinFolder

-- Try multiple times to find template
local coinTemplate
repeat
coinTemplate = coinFolder:FindFirstChild("CoinTemplate")
task.wait(0.2)
until coinTemplate

print("Coin system loaded successfully!")

local spawnArea = workspace
local maxCoins = 50
local spawnInterval = 5

while true do
if #coinfolder:GetChildren() < maxCoins then
local coin = coinTemplate:Clone()
coin.Parent = coinfolder

    -- Make sure your coin has a PrimaryPart
    coin:SetPrimaryPartCFrame(
    CFrame.new(
    math.random(-50, 50),
    5,
    math.random(-50, 50)
    )
    )
end

task.wait(spawnInterval)

end

random parrot
#

..

#

Finding CoinFolder in workspace is mad work

grim galleon
#

Wdym

random parrot
#

U just sent a screenshot CoinFolder is in replicatedstorage

grim galleon
#

Yea

#

It's also in workspace

random parrot
#

Ok

grim galleon
#

Would it be easier if I added you and sent you the game (I'm using studio lite)

random parrot
#

Why are u doing this inside Studio lite

grim galleon
#

Cause I don't have a computer

random parrot
#

There is CoinFolder in ReplicatedStorage and workspace right?

grim galleon
#

Yes

random parrot
#
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Workspace = game:GetService("Workspace")

task.wait(2)

local templateFolder = ReplicatedStorage:WaitForChild("CoinFolder")

local coinFolder = Workspace:WaitForChild("CoinFolder")

local coinTemplate = templateFolder:WaitForChild("CoinTemplate")

print("loaded")

local maxCoins = 50
local spawnInterval = 5

while true do
    
    if #coinFolder:GetChildren() < maxCoins then
        
        local coin = coinTemplate:Clone()
        coin.Parent = coinFolder

        coin.Position = Vector3.new(
            math.random(-50, 50),
            5,
            math.random(-50, 50)
        )
        coin.Anchored = true
    end

    task.wait(spawnInterval)
end

Try this

grim galleon
#

Nothing. Do you want me to add you and send the game to you?

random parrot
#

No

#

Skill issue 💀

#

did it print loadded

grim galleon
#

Yeah it printed

random parrot
#

add a print inside the if statement

grim galleon
#

How I'm terrible at scripting

#

🫤

golden flameBOT
#

studio** You are now Level 3! **studio

grim galleon
#

Well I can still chat but I can't try out my script. I can chat on my other account if you want

hoary reef
#

@random parrot Is Studio Lite an app for mobile? How is it downloaded?

raw pendant
#

why are you using light mode

#

that's illegal in the rs community

hoary reef
raw pendant
#

but its better than nothing lwk

copper radish
#

Think diffirent from real roblox studio since is actually lite studio

hoary reef
golden flameBOT
#

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

lucid warren
#

idk why that wouldnt work

#

are you sure coinsfolder isnt being filled up immediately blocking the loop or something

grim galleon
#

I gave up

raw pendant