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

Edit: just wanna say TextLabel is part of workspace

4 comments

0

Can you please post it in script form; Its at the top of the text editor

0

If its text label is a part of workspace, then why is it under bclone?

0

In your script

0

done marine