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

if game.Workspace.setup.Value == 1 then is running when value is 0. whats going on?

Asked by 5 years ago

so. I have made a script to clone spheres. question 1: do the scripts of clones run when created? question 2: if not, how do you make it run? question3: so the script, first when the game runs then a setup part of the script runs, NOT the script I want the clones to have. when the clones are created, sometimes in output I get the message "sphere setup started" and that's the exact opposite of what its supposed to do. whyyyyy? here is me code:

01local sphere = script.Parent
02local setup = game.Workspace.setup
03if setup.Value == 1 then
04wait(6)
05print("sphere setup started")
06sphere.Transparency = 1
07while true do
08wait(1)
09print("creating sphere...")
10cloned = sphere:Clone()
11    cloned.Parent = sphere.Parent
12print("creating sphere...")
13end
14end
15if setup.Value == 0 then
16sphere.Transparency = 0
17print("sphere created")
18end

1 answer

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

you can disable the cloned script, and have the cloner script enable the cloned script after it has been cloned and everything

i will call the cloned script: "clonedScript" and disable the cloned script

cloner:

1local cloned = clonedScript:Clone()
2cloned.Parent = *where you want to cloned script to be*
3cloned.Disabled = false
0
can you post some code for that? codingMASTER398 52 — 5y
0
edited cheetahjad -4 — 5y
0
nevermind! i fixed it meself codingMASTER398 52 — 5y
0
here, have free reputation for helping codingMASTER398 52 — 5y
Ad

Answer this question