local detector = workspace.red_button.ClickDetector
local door = workspace.door
local StDoor = false
local SoundService = game:GetService("SoundService")
local TweenService = game:GetService("TweenService")
local TweenOpenDoorInfo = TweenInfo.new(1, Enum.EasingStyle.Sine)
local TweenCloseDoorInfo = TweenInfo.new(1, Enum.EasingStyle.Sine)
-- Исправленные целевые значения
local TweenOpenDoorTarget = {
Position = Vector3.new(1.984, 15.866, -40.75)
}
local TweenCloseDoorTarget = {
Position = Vector3.new(1.984, 8.866, -40.75)
}
local TweenOpenDoor = TweenService:Create(door, TweenOpenDoorInfo, TweenOpenDoorTarget)
local TweenCloseDoor = TweenService:Create(door, TweenCloseDoorInfo, TweenCloseDoorTarget)
detector.MouseClick:Connect(function()
if StDoor == false then
StDoor = true
SoundService.DoorClose:Play()
TweenCloseDoor:Play()
print("close")
else
StDoor = false
SoundService.DoorClose:Play()
TweenOpenDoor:Play()
print("open")
end
end)
Помогите как исправить. Вот скрипт:
-----
local detector = workspace.red _button.ClickDetector
local door = workspace.door
local StDoor = false
-----
local SoundService = game:GetService("SoundService")
local TweenService = game:GetService("TweenService")
-----
local TweenOpenDoorInfo = TweenInfo.new (1, Enum.EasingStyle.Sine)
local TweenCloseDoorInfo = TweenInfo.new (1, Enum.EasingStyle.Sine)
-----
local TweenOpenDoorTarget = { Vector3.new (1.984, 15.866, -40.75)}
local TweenCloseDoorTarget = { Vector3.new (1.984, 8.866, -40.75)}
-----
local TweenOpenDoor = TweenService:Create(door, TweenOpenDoorInfo, TweenOpenDoorTarget) -- Строка с ошибкой
local TweenCloseDoor = TweenService:Create(door, TweenCloseDoorInfo, TweenCloseDoorTarget)
-----
detector.MouseClick:Connect(function()
if StDoor == false then
StDoor = true
SoundService.DoorClose:Play()
TweenCloseDoor:Play()
print("close")
else
StDoor = false
SoundService.DoorClose:Play()
TweenOpenDoor:Play()
print("open")
end
end)