UI not tweening

Hello! My name is Chris and I have been working on this ImprovedCAD system for the past few months and i just hopped on yesterday to notice that the Functions I scripted are not working! Oh no! So, I tried troubleshooting by adding prints, visible, not visible, etc. For some reason, no luck. My last decision was to come here and all of you amazing DevForum users!

There is no errors either.

Print log:

Firing Function Code:

for i, v in pairs(LoginMF.openedType:GetChildren()) do
if not v:IsA('UIListLayout') then

	v.MouseButton1Click:Connect(function()
	
	LoginMF.activeStatus.Text = v.Text
	LoginMF.openedType.Visible = false
	Functions.Notify(""..username, "Team Changed.")
	
end)

end
end

Function Code:

module.Notify = function(user, msg)
print("GotNotify")
game.Players[user].PlayerGui.ImprovedCADMisc.Error.mainFrame.err.Text = msg
print("GotNotify1")
game.Players[user].PlayerGui.ImprovedCADMisc.Error.mainFrame.Title.Text = "NOTIFICATION"
print("GotNotify2")
game.Players[user].PlayerGui.ImprovedCADMisc.Error.Visible = true
print("GotNotify3")
game.Players[user].PlayerGui.ImprovedCADMisc.Error:TweenPosition(UDim2.new(0.78, 0, 0.78, 0))
print("GotNotif4")
wait(5)
print("GotNotify5")
game.Players[user].PlayerGui.ImprovedCADMisc.Error:TweenPosition(UDim2.new(1, 0, 0.78, 0))
print("GotNotifydone")
end

Any help is appreciated!

1 Like

I recommend using WaitForChild instead of “.” as I’ve had errors with that in the past. Also make sure you’re tweening the right UI and that the ZIndex is correct. If that doesn’t work, a screenshot of workspace, properties, etc. would help.

1 Like

Scratch my reply above. If I’m correct, the syntax you’re using should work except for one thing:

Change

Functions.Notify(""..username, "Team Changed.")

to

Functions.Notify(Functions.Notify,""..username, "Team Changed.")

I don’t usually use “.” syntax when referencing module functions. I usually use “:” which references the function as the “self” argument.

1 Like

Are you sure that everything under Error is visible? It might be possible that the mainFrame or its children simply aren’t visible, and you are not seeing the entire error gui.

The other error I can think of is Error being nil, but that would be quite obvious since it would throw an error from attempting index nil somewhere along the index chain

It might help to simplify your code with variables by the way:

module.Notify = function(user, msg)
	print("GotNotify")

	local Error = game.Players[user].PlayerGui.ImprovedCADMisc.Error

	print(Error)
	Error.mainFrame.err.Text = msg
	print(1)
	--...
end

I would also use tostring(username) instead of ""..username, it might mean less can go wrong:

for i, v in pairs(LoginMF.openedType:GetChildren()) do
	if not v:IsA('UIListLayout') then
		v.MouseButton1Click:Connect(function()

			LoginMF.activeStatus.Text = v.Text
			LoginMF.openedType.Visible = false -- this couldn't be the cause...
			Functions.Notify(tostring(username), "Team Changed.")

		end)
	end
end

@snorebear the dot syntax is correct actually, there is no need to change it. If he did use the colon syntax, he would have formed his function in the second block like this, with the self argument:

module.Notify = function(self, user, msg)
	--...
2 Likes

Ah, I will do that, but I don’t think that fixes what I am trying to accomplish with this post. :confused:

Thank you for the feedback though!

When I was creating the function shown, I didn’t really think to simplify or organize my code in anyway as it was very late at night, sorry if it’s hard to understand. I double checked with the UI and every element, and it seems it is all visible. As for the tostring, I will try that out.

1 Like

Bump, I seem to be having this problem as well. I decided to just bump instead of making a whole new thread considering the code is nearly the same.