local TL = script.Parent.Parent.TL local TI = script.Parent.Parent.TI local TF = game.Players.LocalPlayer.stats.TotalFollowers local ClickValue = script.CV TL.MouseButton1Up:connect(function() TF.Value = TF.Value + ClickValue.Value x = math.random(400) TI.Visible = true TI.Position = UDim2.new(0,x,0,0) TI:TweenPosition(UDim2.new(0,x,1,0, "Out", "Quad", 5)) print("Clicked!") end)
This is a LocalScript
inside a ImageButton
Hey, I also had this problem happening to me so many times and this problem is a common problem for scripters who use LocalScript
!
According to this site, It stats that LocalScript
are the script which will begin downloading the Client's world and begin to run before any other objects have been downloaded!
My advice is that at the beginning of every LocalScript
you should add wait()
command. If you do not understand what I mean then let me show you an example using your script:
wait(0.1) -- you can set it to how much time it should wait, I normally type in 0.1. local TL = script.Parent.Parent.TL local TI = script.Parent.Parent.TI local TF = game.Players.LocalPlayer.stats.TotalFollowers local ClickValue = script.CV TL.MouseButton1Up:connect(function() TF.Value = TF.Value + ClickValue.Value x = math.random(400) TI.Visible = true TI.Position = UDim2.new(0,x,0,0) TI:TweenPosition(UDim2.new(0,x,1,0, "Out", "Quad", 5)) print("Clicked!") end)
Other than that everyone looks fine for me.
I hope this answer helps you. If you need any more question, feel free to ask me and I will be happy to help you in any way. :)