Whats wrong with the function?

I was creating a function where I can place all of my tweens in but it isn’t working as I want it 2 any tips?

image

It would be helpful if you could tell us what you want to do ultimately with this function as it gives us some context as well as a more in-depth description of the issue you’re currently facing.

in simple terms, the function will hold a bunch of tweens that Im working on for a UI positioning , defining modules
image
(which I already know how to do this stuff)
but when I created the function its just simply not running I tested it by doing the position and also a debug method which is just using print.

Then once played nothing comes up in the output image
meaning it isn’t running correctly.

If you meant something else ill explain better.

show us the number lines, and scroll up

[quote=“Aurised, post:3, topic:1397702”]
image
[/quote] on this output.

What do you mean the number lines? like the lines of code?

local TweenService = game:GetService("TweenService");
local StarterGui = game:GetService("StarterGui");
local Players = game:GetService("Players");
local RunService = game:GetService("RunService");
local ReplicatedStorage = game:GetService("ReplicatedStorage");
local Utility = script.Parent.Parent:WaitForChild("Utility");
local PulseImage = require(Utility:WaitForChild("PulseImage"));
local PulseText = require(Utility:WaitForChild("PulseText"));
local TweenCreate = require(Utility:WaitForChild("TweenCreate"));

local Remotes = {
	Function = ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("RemoteFunction"),
	Event = ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("RemoteEvent")
}

local UI = {}
local function dropAllClasses(Child)
	for i,v in pairs(UI) do
		if UI[i] ~= Child and typeof(Child) ~= "function" then
			Child.Remotes = Remotes
			Child[i] = v
		end
	end
end


local UI = {}
local function loadClasses()
	for i,v in pairs(script.ScriptLib:GetChildren()) do
		if v:IsA("ModuleScript") then
			UI[v.Name] = require(v)
		end
	end

	for i,v in pairs(UI) do
		dropAllClasses(v)
	end
end

loadClasses() 

 local function Animations (CC1, CC2, CC3)
	local Intro = CC1.Intro:WaitForChild("Intro");
	local Cor = Intro:WaitForChild("Cor");
	local Icon = Cor:WaitForChild("Icon");
	local ImageLabel = Icon:WaitForChild("ImageLabel");
	local Tips = Cor:WaitForChild("Tips");
	local TipBar = Tips:WaitForChild("TipBar");
	local TextLabel = TipBar:WaitForChild("TextLabel");	
print("debug")
	ImageLabel.Position = UDim2.new(0.25, 0, 0 , 0);

image

image

In this photo, show us the row numbers on the side.

image

Now show me the ENTIRE output, because this is telling me that there is a error on line 6, scroll up on the output bar:

image

There you go, your script is yielding, this means it’s waiting for something that could possibly never arrive, using :WaitForChild() basically stops the WHOLE script until that child is found, try going with just a plain local Utility = script.Parent.Parent.Utility

ON LINE 6, so where there is the script.parent.parent:WaitforChild()

In the actual function or up here?

What the Infinite yield means is that the script cannot find what you have requested it to, so your issue is on Line 6 make sure that the UI object you’re trying to reference is in the right place and that it isn’t being moved by other scripts.

yeah, I got the whole function thing down but then there is :waitforchild problems now;

Try adding a

wait(2)

at the top of your script. And see if anything runs?

Can I see where the function Animations gets called from and where the three parameters came from?

image

I notice that when you call the Animations function you are not passing the CC1 parameter that the functional obviously requires to function, make sure to pass a proper Object into this parameter.

Isnt this basically passing it into the UI? image image

No, because when you call the function
image

Which is underlined in the function the CC1 parameter within the function is left as nil which means nothing is there, the rest of the function won’t work because it has nothing to work with

So what could I put there? or is there a different way I could find this as a :findfirstchild so I can get rid of the CC1? image

I’m planning to have multiple functions in this 1 localscript.