local Player =  game.Players.LocalPlayer
local Mouse = Player:GetMouse()

local OpenDoor = game:GetService("ReplicatedStorage").OpenDoor

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.E then
	if Mouse.Target then
	    OpenDoor:FireServer(Mouse.Target)	
		end
    end
end)

local peeking = false

while true do
	wait()
	if Mouse.Target == workspace.Door then
		if peeking == false then
			peeking = true
			local bClone = script.Parent.Button:Clone()
			bClone.Parent = workspace.CurrentCamera
			bClone = workspace.Door
			bClone.TextLabel.Visible = true
		end
	else
		if peeking == true then
			if workspace.CurrentCamera:FindFirstChild("Button") then
				workspace.CurrentCamera.Button:remove()
				peeking = false
			end
		end
	end
end

Says: TextLabel is not a valid member of Part

5 comments

0

I looks like your using the same varible and just reseting it, I would change that to two different varibles

0

And in your other post, you said that textLable is under workspace, So the path to the textlabel is workspace.Door.TextLabel, not workspace.TextLabel

0

what should i change it to?

0

Oh, for textLabels, you need a surface gui

0

Ok- i changed i to workspace.textLabel but still getting the same error