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

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

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?

1 comment

0

It is attempting to get a child of the name 'guiName', not the gui 'Teresa'.

1 answer

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

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