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

What's wrong with this function?

function ChangeBase(brick)
	brick.Transparency = 0.5
end 

ChangeBase(Base)

-I don't have a part named 'brick' inside workspace, but I have a brick named 'Base' inside workspace

OUTPUT: Workspace.Script:2: attempt to index local 'brick' (a nil value) 13:03:11.924 - Script 'Workspace.Script', Line 2 - global ChangeBase 13:03:11.924 - Script 'Workspace.Script', Line 5 13:03:11.925 - stack end

1 answer

✓ Accepted answer

Your problem is you're trying to use Base but roblox doesn't know what it is. How would they know?

You need to work with objects roblox does know, and work your way towards Base.

Luckily, Workspaceis predefined in all scripts! To fix your error, just put Workspace.Basewhere Base is!

ChangeBase(Workspace.Base)

1 comment

0

Thanks, it worked

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