for specific cards you need to use tables but it should work if the hit.parent.name has “Card” spelt exactly in it
2 Likes
local AnimationService = game:GetService("TweenService")
local TweenInfor = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
local RepublicStorage = game:GetService("ReplicatedStorage")
local Dedector = script.Parent.Level_1
local Door1 = script.Parent.Door1
local Door2 = script.Parent.Door2
local Door1Position_Open = Door1.Position + Vector3.new(2, 0, 0)
local Door2Position_Open = Door2.Position - Vector3.new(2, 0, 0)
local DoorAnimation1 = TweenService:Create(Door1, TweenInfor, {Position = Door1Position_Open})
local DoorAnimation2 = TweenService:Create(Door2, TweenInfor, {Position = Door2Position_Open})
local Deceptrion = false
local validCards = {
"Card_1", "Card_2", "Card_3", "Card_Chaos", "Card_4", "Card_5", "Card_Omni"
}
Dedector.Touched:Connect(function(hit)
if not Deceptrion and table.find(validCards, hit.Parent.Name) then
Deceptrion = true
print("open")
DoorAnimation1:Play()
DoorAnimation2:Play()
Dedector.Color = Color3.fromRGB(91, 255, 88)
task.wait(2)
Dedector.Color = Color3.fromRGB(255, 0, 0)
DoorAnimation1:Play()
DoorAnimation2:Play()
task.wait(0.5)
print("Doors closed.")
Deceptrion = false
end
end)
2 Likes
This is What i need. @juju_lebeIge @SelfDeclared Is this okei if i change Solution? which the closest one (for me)?
1 Like
You can keep the previous 1 its cool
2 Likes
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.