Something happening when a part is transparent

Hello!
I am trying to make the text on a text label change when a part goes transparent, but it doesnt seem to work. Here is my script so far, if anyone could help that would be great!

local text = script.Parent.SurfaceGui.TextLabel

local activation = game.Workspace.Activation

while true do

if activation.Transparency == 1 then

text.Text ("10")

wait (1)

text.Text ("9")

wait (1)

text.Text ("8")

wait (1)

text.Text ("7")

wait (1)

text.Text ("6")

wait (1)

text.Text ("5")

wait (1)

text.Text ("4")

wait (1)

text.Text ("3")

wait (1)

text.Text ("2")

wait (1)

text.Text ("1")

wait (1)

text.Text ("0")

wait (1)

end

end
local text = script.Parent.SurfaceGui.TextLabel

local activation = game.Workspace.Activation

if activation.Transparency == 1 then

for i = 10,0,-1 do
text.Text = i
wait(1)
end
end

That does not seem to work?..

What kind of script is this? Where is it in the Explorer? Where are you setting the Transparency of “Activation”? A bit more context is needed before we can give a definite fix.

The problem is likely that you’re doing text.Text ("whatever"). Text is a property of TextLabels that you can set with an =. You can’t call it like a function. It should look like text.Text = "whatever"

@Crrustyy That’s even worse, it’d only check once instead of continuing to check. You’re better off using an event connection, like so:

local text = script.Parent.SurfaceGui.TextLabel

local activation = game.Workspace.Activation

activation:GetPropertyChangedSignal[[Transparency]]:Connect(function()
	if activation.Transparency == 1 then
		for i = 10, 0, -1 do
			text.Text = i
			wait(1)
		end
	end
end)
4 Likes

The script is a normal script. It is located in the part that I want the text to change on. The activation part is just a brick in the workspace. And i already tried doing it with ‘=’ before, but it wasnt working. So i tried all I could think of. This does however now work, thank you very much!