Click Key Door for new game

Hello, I am a new developer who is making a story game. I have a key that you can click to pick up but I don’t know how to make a door that you click when you have the key to make the door disappear.( I am not asking for the code but does anyone have a tutorial I can watch) the only tutorials I find are if you touch the door but I want a click one.

4 Likes

You can create a local script inside that tool, with a function that runs when the tool is equipped, and the function will give you the player’s mouse, using the mouse.Target you can destroy the door (make it disappear). You can destroy it from the server for everyone to see, or from the client, and only the player with the key will see.
Mouse.Target

2 Likes

Or tween it to make it look more realistic…

3 Likes

Hi, you can make a server sided script into the door, and then you can add a Click Detector to the part you want to be touched, (only part, not model).
In the script you can make a function connected to the roblox signal of click detector and to check if in the player’s character there is a tool called as the key.
then you can do whatever you want, for example as @Kamlkaze_Kid said, you can use tween service to tween the cframe of the door’s primary part.

2 Likes

A click detector won’t work here because you can’t click on it with a tool. And @Kamlkaze_Kid he asked for it to disappear, but tweening is an option too.
Here’s an example for a local script.

script.Parent.Equipped:Connect(function(mouse) --When the tool is equipped
      mouse.Button1Down:Connect(function()
           --Use the Mouse.Target to desteroy the target if it's a door, or tween it as Kamlkaze_Kid said.
      end)
end)
2 Likes

Oh, i didn’t know you can’t click a click detector with an equipped tool…

1 Like

Nope, you can’t use a click detector with an equipped tool, here’s a video of what will happen:
robloxapp-20200629-2116032.wmv (1.7 MB)
That just won’t let you click.

1 Like

Oh so @OP want to pick a tool up and then unlock a door with the tool?

Yes, that’s what I understood.

1 Like

Yeah so if you put my script into the tool and make a few changes, it should work. But honestly @OP didn’t really explain the question very well

2 Likes

Basically yes, but you need to use the mouse.Target here to detect what the player clicks on, and mouse.Button1Down to detect the click, and not a click detector. And that can’t be a server script, the mouse only works locally.

Edit: it auto-corrected me, I meant click.

2 Likes

Hello! I’m a new developer as well and I’ve learned a lot by watching YT videos about scripting and building. I found out this video that can help you a lot

It’s really easy to understand and might solve your problem. Hope it helps!

  • Dvd