Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
corbenv 17
4 years ago

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

0
Is this in a script or local script? Code1ng 15 — 4y
0
for all i can see this should make the block visible  OBenjOne 190 — 4y
0
It's in a local script corbenv 17 — 4y
0
You'll need to move it to a script as a local script wont be able to change anything in the server deth836231 142 — 4y

3 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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.

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. corbenv 17 — 4y
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 deth836231 142 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

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.

0
That should essensially do the same thing the original does OBenjOne 190 — 4y
Log in to vote
-1
Answered by
iuclds 720 Moderation Voter
4 years ago

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
0
think* iuclds 720 — 4y
0
You need end) at the end of a function and Touched is right OBenjOne 190 — 4y

Answer this question