Why doesn't my script work?

Hello, I made these two scripts but can you tell me why they don’t work? I want that as the part becomes transparent = 0, I want that the value of number and + 6

local part = workspace.Part
local tables = {["Number"] = 45;}

if part.Transparency == 0 then
    tables["Number"] = tables["Number"] + 6
end

-- or 

if part.Transparency == 0 then
    tables.Number = tables.Number + 6
end
3 Likes

It only checks once, before ending. You would have to wrap this in a while true do end loop or a wait until connection

2 Likes

It does not work, I dont know why ?

1 Like

Are they any errors in the output?

1 Like

I have no output error, Nothing

i recomend a .changed event if this doesn’t work for you use a while loop

local part = workspace.Part
local tables = {["Number"] = 45;}

part.Changed:Connect(function()
	if part.Transparency == 0 then
		tables["Number"] = tables["Number"] + 6
		print(tables["Number"])
	end
end)
2 Likes

use RunService.Heartbeat:Connect()

Thanks you for the help Thanks.

Thanks you very much for the help

The phrasing of this question is misleading

Oh? ,What do you mean by that ?