Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why the script isn't doing anything when i try to clone a ball?

Asked by
MpAlex 16
4 years ago
Edited 4 years ago

I want to spawn a cloned part but is not spawning. I don't get any error but when i remove "wait(1000)" it works and crashes my roblox studio. Also i want it to spawn random between 2 parts, but i don't know how to do it, maybe someone could help me.

Script:

01local part = workspace.Handle
02local Event = game.ReplicatedStorage.Fire
03 
04local Entitati = 0
05local SpawnEntitati = true
06 
07 
08while SpawnEntitati == true do
09    if Entitati <= 50 then
10        wait(1000)
11        print("Ai asteptat 1000 minisecunde (o secunda)")
12        local cpart = part:Clone()
13        cpart.Parent = workspace
14        cpart.Position.X = part.Position.X
15        cpart.Position.Y = part.Position.Y + 1
View all 25 lines...

Also i tried this code to spawn random between 2 parts:

01local part = workspace.Handle
02local Event = game.ReplicatedStorage.Fire
03local pos1 = workspace.pos1
04local pos2 = workspace.pos2
05 
06local Entitati = 0
07local SpawnEntitati = true
08 
09 
10while SpawnEntitati == true do
11    if Entitati <= 50 then
12        wait(1000)
13        print("Ai asteptat 1000 minisecunde (o secunda)")
14        local cpart = part:Clone()
15        cpart.Parent = workspace
View all 25 lines...

Photo

IS NOT A LOCALSCRIPT.

edit: Thanks both for helping me. Thought it was in miliseconds :D

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

You are waiting for 1000 seconds. You need to change the

to the number you want in seconds.

Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

You're waiting for one thousand seconds, not miliseconds!

Wait takes a number in seconds as its argument. Otherwise it waits for three miliseconds, 0.03 seconds.

Answer this question