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
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.
I don’t usually use “.” syntax when referencing module functions. I usually use “:” which references the function as the “self” argument.
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:
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.