Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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.

2 comments

0

what

0

What script give me more info

2 answers

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.

5 comments

0

Thanks for answer, so i cannot put a script into wait for a data input from another, right?

0

Wdym? I don't understand what you mean by that.

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

0

Yes you can.

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

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.