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

How do i transfer a value from a model.A into a script in model.B?

Asked by 7 years ago
Edited 7 years ago

Any ideas? I tried with Events but seems that it does not work properly.

Edit: There is a model with an accessible Intvalue. I want to pass that value into a GUI (like a computer screen). The problem is, that there are multiple modelA that share the same name.

How do i access that "unique" Intvalue and screen it on the GUI?

I already know how to do a simple GUI but i lack the knowledge to transfer data between scripts. One script takes value from the source modelA and the other shows the GUI with updated data.

0
what creeperhunter76 554 — 7y
0
What script give me more info rilgundam 65 — 7y

2 answers

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

You cannot, however, if a script is in it, you can do script.Parent. Otherwise, they will need to have different names. Hope this helps! Edit: To wait for a script to put an output, we can use LogService. Here is an example of a script sending info to another one. (Remote events would be better for this, but we can still use LogService.)

--First script
wait(10)
print(script:GetFullName()..' is ready!') --Let's assume this prints  "game.Workspace.Script is ready!"

--Second script:
local ready = false

game:GetService('LogService').MessageOut:Connect(function(message, msgtype)
    if msgtype == 0 or msgtype == 1 --[[The wiki is confusing about this, so I just included 0 and 1.]] then
        if message == 'game.Workspace.Script is ready!' then
            ready = true
        end
    end
end)
repeat wait() until ready == true
--insert code here

So yes, you can wait until something appears in output.

0
Thanks for answer, so i cannot put a script into wait for a data input from another, right? jonathan3576 12 — 7y
0
Wdym? I don't understand what you mean by that. hiimgoodpack 2009 — 7y
0
I mean that scripts can not work together. ie, one wait the output of another. Imagine a prove satellite that stores and send data to a computer in Earth jonathan3576 12 — 7y
0
Yes you can. hiimgoodpack 2009 — 7y
0
I could solve the thing, but i posted another question regarding it. I could access the value inside the reservoir but now i have the problem that every new spawned "Drill" get the same number as the first spawned jonathan3576 12 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

You cannot have 2 models with the same names. You will have to rename all of your models so they don't share their names. Or you will have to make multiple scripts and that's not effecient at all.

Answer this question