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 4 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:

local sphere = script.Parent
local setup = game.Workspace.setup
if setup.Value == 1 then
wait(6)
print("sphere setup started")
sphere.Transparency = 1
while true do
wait(1)
print("creating sphere...")
cloned = sphere:Clone()
    cloned.Parent = sphere.Parent
print("creating sphere...")
end
end
if setup.Value == 0 then
sphere.Transparency = 0
print("sphere created")
end

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 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:

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

Answer this question