My script can't identify button2 in this boolean i made?
Asked by
4 years ago Edited 4 years ago
local EEEE = false
game.Workspace.Button.Touched:Connect(function()
EEEE = true
if EEEE == true then
game.Workspace.Button.Touched:Connect(function()
Instance.new("Part",game.Workspace)
game.Workspace.Part.Name = "Button2"
game.Workspace.Button2.BrickColor = BrickColor.new("Really red")
game.Workspace.Button2.Position = Vector3.new(159.5, -110.5, 32.5)
game.Workspace.Button2.Size = Vector3.new(5, 1, 5)
game.Workspace.Button:Destroy()
end)
end
end)
EEEE=false
game.Workspace.Button2.Touched:Connect(function()
EEEE=true
if EEEE == true then
game.Workspace.Button2.Touched:Connect(function()
Instance.new("Part",game.Workspace)
game.Workspace.Part.Name = "Button3"
game.Workspace.Button3.BrickColor = BrickColor.new("Really red")
game.Workspace.Button2:Destroy()
game.Workspace.Button3.Position = Vector3.new(95.5, -110.5, -149.5)
game.Workspace.Button3.Size = Vector3.new(5, 1, 5)
game.Workspace.Button3:Destroy()
end)
end
end)
So this seemed good, but when I ran it, the output said 09:34:19.719 - Button2 is not a valid member of Workspace. Please help me!