So, I was making a game and I ran into the error “attempt to call a nil value”
This is my code:
local Transparency = game.Workspace.Barpart1.Transparency
local CanCollide = game.Workspace.Barpart1.CanCollide
local function open()
Transparency = 1
CanCollide = false
end
game.Workspace.Barpart1.ClickDetector.MouseClick:Connect(open())
I am unable to find a solution to this problem, i’ve tried defining some of the values in my script but it doesn’t seem to have worked.
How can I fix this problem?