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 Run Certain Function(s) That Are In Another Script?

Okay so, basically I just have several functions doing different things in several different parts, although I'd just like to have one other script to tell them when to run at once if I can.

In more detail to try and explain if I haven't already: Several different parts in the workspace, all with their own script inside. They each have different functions inside those script.

Random examples to run at once:

local function playdisco
	while true do
		script.Parent.Brickcolor = Brickcolor.Random()
		wait(0.5)
	end
end
local function changetrans
	while true do
		script.Parent.Transparency = 0.5
		wait(0.5)
		script.Parent.Transparency = 0.9
		wait(0.5)
	end
end

2 answers

Use a RemoteFunction object, more info can be found here: Remote Events and functions. P.S consider using a coroutine if you're going to have more than one function at a time using a loop in the same script.

_G.playdisco = function()
	while true do
		script.Parent.BrickColor = BrickColor.Random()
		wait(0.5)
	end
end

just make a script and add this

_G.playdisco

do the same with changetrans

_G.changetrans = function()
	while true do
		script.Parent.Transparency = 0.5
		wait(0.5)
		script.Parent.Transparency = 0.9
		wait(0.9)
	end
end
_G.changetrans

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