What do you want to achieve? To be able to change the TextLabel’s Text into test when you click the part.
What is the issue? The code doesn’t work as intended, more specifically, the variable “arvo” isn’t working in the code.
What solutions have you tried so far? Not using the variable and instead just typing the exact line there, it worked.
local arvo = script.Parent.kalikka1.SurfaceGui.TextLabel.Text
local klikkeri = script.Parent.kalikka1.ClickDetector
script.Parent.kalikka1.ClickDetector.MouseClick:Connect(function()
arvo = ("test")
end)
local arvo = script.Parent.kalikka1.SurfaceGui.TextLabel -- Not .Text here
local klikkeri = script.Parent.kalikka1.ClickDetector
script.Parent.kalikka1.ClickDetector.MouseClick:Connect(function()
arvo.Text = "test" -- .Text here instead
end)
For an explanation, previously you were just assigning whatever value “Text” held of the “TextLabel” instance it pertained to, to the variable “arvo”, then when you referenced arvo again to assign to it a string value of “test” you were just overriding the previously assigned value as opposed to changing the value of the “Text” property of the “TextLabel” instance.