script:
local keycard = workspace.Technical.KeyCard1.ClickBox.ClickDetector
PlayerGui = game:GetService(“Players”):WaitForChild(“LocalPlayer”):WaitForChild(“PlayerGui”)
local kv = false
keycard.MouseClick:Connect(function()
PlayerGui:WaitForChild(“GUI”):WaitForChild(“KeyCardGetText”).Visible = true
if kv == false then
kv = true
keycard.Parent.Parent.Parent.KeyCard1:Destroy()
end
task.wait(3)
PlayerGui:WaitForChild(“GUI”):WaitForChild(“KeyCardGetText”).Visible = false
end)
local ts = game:GetService(“TweenService”)
local wall = game.Workspace.Technical.Secret_Wall
local ti = TweenInfo.new (
5,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out
)
local goal = {Position = Vector3.new(wall.Position.X, wall.Position.Y +7, wall.Position.Z)}
local tween = ts:Create(wall, ti, goal)
game.Workspace.Technical.CardReader.ClickBox.ClickDetector.MouseClick:Connect(function()
if kv == true then
tween:Play()
task.wait(6)
game.Workspace.Technical.ElevatorWall.CanCollide = false
print(“tween played”)
else
PlayerGui:WaitForChild(“GUI”):WaitForChild(“NoKeyCardText”).Visible = true
task.wait(4)
PlayerGui:WaitForChild(“GUI”):WaitForChild(“NoKeyCardText”).Visible = false
end
end)
it checks if the player got a keycard, if they didn’t, it makes UI appear, if they did, the tween plays. no error, only “Infinite yield possible on ‘Players:WaitForChild(“LocalPlayer”)’”