Im trying to make a counter Gui for every time the part is clicked, yet for the life of me I can’t find out why the counter isn’t going up. Here is what I have so far:
local target = game.Workspace.Target
local ClickDetector = Instance.new("ClickDetector")
ClickDetector.Parent = target
local counter = script.Parent --This is the TextLable Gui
local clickCounter = 0
counter.Text = clickCounter
ClickDetector.MouseClick:Connect(function(ClickDetector)
clickCounter = clickCounter + 1
counter.Text = clickCounter
end)
In my head this all seems right but the counter doesn’t ever change on screen. the script is a local script in the text itself. If you have any idea how to fix this I would greatly appreciate it, but please make its simple enough for me to understand because I am still learning the basics of Lua here.
I appreciate the feedback and I did attempt this, with sadly no success, triple checking everything was inserted correctly and in the right spots. I havn’t learned much about replicated storage yet though so this is not really in my range of comprehension as of now in fixing it myself sadly. Thank you for the feedback though, any other suggestions are always welcome!
the script under target is just a script to make the target move when clicked. I found that something is wrong with the output in general because it wont even print a string when i click on the part, something seems a bit off
I dont see other problem then the thing when u are setting the gui text. As u can see u are just changing variable instead of real gui,
Insteaf of counter.Text u should do script.Parent.Text also u should might consider putting clickCounter into string… script.Parent.Text = tostring(clickCounter)