You are trying to click a text label but really you should be clicking a text button. How I would personally go about this is making a invisible text button right on top of your text label and im guessing you want the press the button once based on your example given so heres how I would do this and hopefully it helps.
local starterGui = game:GetService("StarterGui")
local textButton = starterGui.ScreenGui:WaitForChild("TextButton")
local textLabel = starterGui.ScreenGui:WaitForChild("TextLabel")
clicked = false
textButton.MouseButton1Click:connect(function()
if clicked == true then
return
end
textLabel.Text = "98"
clicked = true
end)
Again, hopefully this helped guide you in the right direction and if it did, make sure you mark the answer as solved! :)
4 comments
I don't see any issues with this. After you click the button, you sure it doesn't change the text? All looks good
Is this in a LocalScript?
For the function is it just script.Parent or is it supposed to be script.Parent.Parent?
This is in a text button , in a local script. It is suppose to be script.Parent.Parent