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

How do you fix this door?

Hello, I can't script at all, but my friend made a door that was supposed to be opened when clicked. Can you please, please fix it for me dear helpers?

team = game.Teams.OfficeStaff -- Put team name here player = "Player1" door = script.Parent function onClicked() if script.Parent.ClickDetector.MouseClick == player then door.CFrame = door.CFrame * CFrame.new(0, 0, 1)

end end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

--[Made by AgentL3r]--

Can you please fix it for me/him?

2 comments

0

You are going to need to make this have Lua formatting for the code and to space out the lines because I can barely read that

2

This would fall into the category of a request, since you admitted to not knowing a thing about coding. It's basically asking for free scripts. This site is for improving one's coding skill.

1 answer

Even though this is a request I'll help to fix it anyways.

team = game.Teams.OfficeStaff -- This line doesn't do anything but I'll leave it in case you need it.
player = "Player1" --Set this line to your name, or use the other section of code below to let everyone use the door.
door = script.Parent
function onClicked()
	if script.Parent.ClickDetector.MouseClick == player then
		door.CFrame = door.CFrame * CFrame.new(0, 0, 1)
	end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

--[Made by AgentL3r with a small edit from bobder2]--

This one will work for anyone:

team = game.Teams.OfficeStaff -- This line doesn't do anything but I'll leave it in case you need it.
door = script.Parent
function onClicked()
	door.CFrame = door.CFrame * CFrame.new(0, 0, 1)
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

--[Made by AgentL3r with a small edit from bobder2]--

Neither of these two sections of code will close the door, I'll let you and your friend figure that out on your own, it's not too hard just take a look at this code and at the roblox wiki.

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