Help with vector

I have a door they required a key to open and it has to touch the keyhole to open and I want it where when the key touches the key hold a version of the same key goes where the keyhole is anyone know how to help me with the vector


Pedestal is where I want the key to go and key1 is the key to open the door and HandleDup is the thing I want on the pedestal

Could you possible post the code here. I cannot read the code in the image.

1 Like

Ye let me get on the pc hold up

"local doormodel = script.Parent
HandleDup = game.Workspace.HandleDup

local TweenService = game:GetService(“TweenService”)
local doorTweenInfo = TweenInfo.new(
4,
Enum.EasingStyle.Bounce,
Enum.EasingDirection.Out,
0,
false,
0
)

local leftDoorTween = TweenService:Create(doormodel.LeftDoor, doorTweenInfo, {CFrame = doormodel.LeftDoorOpen.CFrame})
local rightDoorTween = TweenService:Create(doormodel.RightDoor, doorTweenInfo, {CFrame = doormodel.RightDoorOpen.CFrame})

doormodel.Keyhole.BrickColor = doormodel.Key.Value

doormodel.Keyhole.Touched:Connect(function(hit)
if hit.Parent:IsA(“Tool”) and hit.Parent.Name == “Key1” and hit.brickColor == doormodel.Key.Value then
doormodel.Keyhole:Destroy()
leftDoorTween:Play()
rightDoorTween:play()
end
end)
"

im trying to make it where after i touch the pedestal with the key the copyed version of it goes on the pedestal making it look like i placed it down

Can’t you make the key a model that is invisible on the door.

Then, you can run the function and just change the transparency of the key, when the tool touches it.

Oh lol Dident think of that can u help me a bit more I’m not really good at scripting and where to put it

Ok the handle dup is now in the model what I do now

doormodel.Keyhole.Touched:Connect(function(hit)
if hit.Parent:IsA(“Tool”) and hit.Parent.Name == “Key1” and hit.brickColor == doormodel.Key.Value then
--referencing where the invisible key model is--.Transparency = 0
end
end)

It said HandleDup is not a valid member of workspace

Wait I know why let me try hold up

Do local HandleDup = game.Workspace.HandleDup

Is “HandleDup” in workspace?

1 Like

It worked 2 more things how do I make it where the key destroys after I open the door and make it click to open door instead of touch

You’re wanting the door to open once the key is inserted into the key hole, correct?

–Referencing where the key is–:Destroy()

Yea how do I make it where the key leaves the inventory after

I got it figured out already but thanks

Reference where the tool actually is first.
So, for example:
hit.Parent

Then to remove it do:
hit.Parent:Destroy()

That’s great to hear, at least you’re learning! :sweat_smile:

Alright what about the click instead of touch