Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Script not doing anything when I try to change a block's transparency?

No errors in output. I swear this worked before in a different project.

local money = 20

script.Parent.Touched:connect(function(work)
	if money > 10 then
		workspace.Block.Transparency = 0
	end
end)

I'm getting really sick of scripting tbh. Nothing ever works

4 comments

0

Is this in a script or local script?

0

for all i can see this should make the block visible 

0

It's in a local script

0

You'll need to move it to a script as a local script wont be able to change anything in the server

3 answers

✓ Accepted answer

What you need to fix is what the transparency is set to. Your code is correct its just that you need to use a 1 instead of a 0

local money = 20

script.Parent.Touched:connect(function(work)
    if money > 10 then
        workspace.Block.Transparency = 1
    end
end)

For transparency you can pick numbers between 1-0 (side note: numbers bigger than one and less than 0 can be used but wont change much as something cant be more invisible then 100% and something can't be less than 0% invisible) the bigger the number you put the more transparent the object will be while the less the number you put the more visible it will be.

2 comments

0

why do I want to put 1 instead of 0? It still does not work plus I'm trying to make the block visible.

0

Ahh if its for visible then 0 it is but it may not work as it can't find the block that you want or you have many things in the workspace called block. So make sure that is the right path and or thats the only one named block in the workspace

Try this:

Target = game.Workspace.Block
----------------------------
local money = 20 
	script.Parent.Touched:connect(function(work)
	    if money >= 10 then
	     Target.Transparency = 0
	end)

Hope this helped.

1 comment

0

That should essensially do the same thing the original does

I believe its

local money = 20
script.Parent.onTouched:connect(function(work)
blah blah
blah blah
script.Parent.Transparency = 1
but i dont thin we add ends anyways

2 comments

0

think*

0

You need end) at the end of a function and Touched is right

This discussion is preserved as it was. New answers, comments, and votes are closed.