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

How can I plug in parameters to control tasks like :Destroy()/Rotations?

Asked by 9 years ago

Here is part of my script.

local GuiRotate_1 = coroutine.wrap(function(guiName)
for i = 0.1, 20, .5 do
wait(.1)
script.Parent.Screen.guiName.Rotation = i --> guiName is not a valid member of Frame. 
end

GuiRotate_1("Teresa");

Do you see what it says? guiName is not a valid member of Frame. Now why is this?

Screen is a** PARENT** of Teresa which guiName is definied for because I passed it in the parameter. My question is, why is this happening and how can it be fixed?

0
It is attempting to get a child of the name 'guiName', not the gui 'Teresa'. TheeDeathCaster 2368 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

Simple, you passed a string when it expected an object. Just modify your code to accept strings:

Change line four to script.Parent.Screen:FindFirstChild(guiName).Rotation = i

Ad

Answer this question