So I am making an admin system, and I trying to make it so if there are multiple “hints” on the screen at any given time (bar text at the top of the screen), it will put them into a uniform line, I am using tweening so I cannot use UI constraints and so I am using this code here:
if plr.PlayerGui:FindFirstChild("Hints"):FindFirstChild("PrevHint") == nil then
Hint_2:TweenPosition(UDim2.new(0, 0, 0, 0),"Out","Sine",0.3,false)
else
Hint_2:TweenPosition(UDim2.new(0, 0, plr.PlayerGui:FindFirstChild("Hints"):FindFirstChild("PrevHint").Position + UDim2.new(0,0,0.048,0)),"Out","Sine",0.3,false)
end
Please note that there is more code which would make this work, the reason why I am not showing this is because I used plr.PlayerGui:FindFirstChild("Hints"):FindFirstChild("PrevHint") in a completely different script and it works, that is the source of why it isn’t working I believe, can anyone help me out?
I do that whenever tweening a part with changing the size or colour for example, but tweening with Guis doesn’t require :play() thanks for your help though.
This problem is plr.PlayerGui:FindFirstChild("Hints"):FindFirstChild("PrevHint") the tweening part works but for some reason it can’t find the hint, yet I have tried it in other scripts and it can find the hint.
Yes I have tried checking to see if it is there, both from the server and client side and it is there but the script cannot detect it yet it works with the same code in a different script.
If you are trying to figure out if something does not exist I would suggest using the not statement
Example:
if not plr.PlayerGui:FindFirstChild(“Hints”):FindFirstChild(“PrevHint”) then
I have now fixed the error, thank you for everyone’s help, it was because I switched if plr.PlayerGui:FindFirstChild("Hints"):FindFirstChild("PrevHint") == nil then to if prevHint == nil then and I set up a variable called prevHint, but I had the variable in the chatted event so it was reset each time the player chatted.