Door system always doesn't open with or without a keycard in the backpack?
Asked by
2 years ago Edited 2 years ago
Hello!
Let's cut to the chase, I am attempting to make a keycard system in which you have to click the keycard scanner with a keycard in your backpack.
(I did this instead of having to check for a keycard in their character, because apparently clickdetectors don't work with tools on)
Now, there are no errors or anything. Even with the keycard in the playres backpack, it will always deny access (play a denied sound and not open the door) and I seriously need help.
Here's the code:
01 | slider = script.Parent.Model.touchz |
02 | acceptedsound = script.Parent.accepted |
03 | declinedsound = script.Parent.declined |
05 | local openClick = game.Workspace.DoorButton 1. fart.ClickDetector |
06 | local tweenService = game:GetService( "TweenService" ) |
08 | Position = Vector 3. new(- 198.327 , 12.12 , 71.057 ) |
10 | local TweenInfoo = TweenInfo.new( 1 ,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut) |
11 | local tween = tweenService:Create(script.Parent,TweenInfoo,Properties) |
13 | Position = Vector 3. new(- 198.287 , 4.39 , 71.057 ) |
15 | local TweenInfooo = TweenInfo.new( 1 ,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut) |
16 | local tween 2 = tweenService:Create(script.Parent,TweenInfooo,Properties 2 ) |
18 | slider.ClickDetector.MouseClick:Connect( function (player) |
19 | if player.Backpack:FindFirstChild( "Keycard" ) then |
This is probably what is wrong with the script:
1 | slider.ClickDetector.MouseClick:Connect( function (player) |
2 | if player.Backpack:FindFirstChild( "Keycard" ) then |
https://cdn.discordapp.com/attachments/1076530438912356392/1076817600698396682/image.png
A picture of the tools in the backpack, in case that would help.
Thank you in advance for helping!
edit: forgot to include .MouseClick