I mentioned this yesterday and I got some replies but none of them worked. So here is my problem again: I want it so if the card touches something (i this case a black block(which is the reader)) I want the gates to open. I managed to get it to work if the key card was in the same model as the gate and reader. But I want to move it to the starter pack. This is what I have so far but it does not work in a normal script or local script!
local TweenService = game:GetService("TweenService")
local door1 = script.Parent:WaitForChild("DelivGateLeft")
local door2 = script.Parent:WaitForChild("DelivGateRight")
local card = script.StarterPack.Parent:WaitForChild("Card")
local tweeningInformation = TweenInfo.new(
7,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out,
0,
false,
0
)
local door1Open = {CFrame = CFrame.new(564.803, 8.762, 73.63)}
local door2Open = {CFrame = CFrame.new(564.645, 8.786, -60.269)}
local door1Close = {CFrame = CFrame.new(564.803, 8.762, 38.112)}
local door2Close = {CFrame = CFrame.new(564.645, 8.786, -22.148)}
local tween1open = TweenService:Create(door1,tweeningInformation,door1Open)
local tween1close = TweenService:Create(door1,tweeningInformation,door1Close)
local tween2open = TweenService:Create(door2,tweeningInformation,door2Open)
local tween2close = TweenService:Create(door2,tweeningInformation,door2Close)
script.Parent.Detector1.Touched:Connect(function(hit)
if hit == card.handle then
tween1open:Play()
tween2open:Play()
wait(10)
tween1close:Play()
tween2close:Play()
end
end)
Also here are some pictures:
https://drive.google.com/file/d/1oV7AMXga176uJ4XTv4XuRrfhRGBCIqjj/view?usp=sharing
https://drive.google.com/file/d/1JspCWHcqZw5FRdw7Zx5asAg60rPKOCvQ/view?usp=sharing
Thanks

1 comment
Thanks!