so i have an error, this part isnt tweening even tho it should, the value of the door open is set (i checked)
and nothing pops up in output
heres the script
local event = game.ServerStorage.Doors
local TS = game:GetService("TweenService")
local currentlevel = game.ReplicatedStorage.CurrentLevel
local door
event.Event:Connect(function(doorv,open)
local dooropen : Vector3
local doorclosed : Vector3
doorclosed = doorv.ClosedVector.Value
dooropen = door.OpenVector.Value
local t1 = TS:Create(door,TweenInfo.new(1),{Position = dooropen})
local t2 = TS:Create(door,TweenInfo.new(1),{Position = doorclosed})
local doorname = string.split(doorv,":")
door = game.Workspace[doorname[1]].Doors[doorname[2]]
door.Open.Value = true
if open == true then
t1:Play()
else
t2:Play()
end
end)
is there any issue?
1 Like
Is that the whole script?`
Sincerely Delusively
1 Like
yes, it is the whole script, i am not joking that is it
1 Like
Well if that is the whole script then yes, there are a few issues with the script that may be causing the tween not to work:
- The
door
variable is assigned after it is used in the TweenService, which will result in a nil value error.
- The
door.Open.Value
is set to true before the door
variable is assigned, which will result in a nil value error.
- The
door
variable is not declared before it is used.
To fix these issues, you can try the following updated script:
local event = game.ServerStorage.Doors
local TS = game:GetService("TweenService")
local currentlevel = game.ReplicatedStorage.CurrentLevel
event.Event:Connect(function(doorv,open)
local doorname = string.split(doorv,":")
local door = game.Workspace[doorname[1]].Doors[doorname[2]]
local dooropen = door.OpenVector.Value
local doorclosed = doorv.ClosedVector.Value
door.Open.Value = true
local t1 = TS:Create(door,TweenInfo.new(1),{Position = dooropen})
local t2 = TS:Create(door,TweenInfo.new(1),{Position = doorclosed})
if open == true then
t1:Play()
else
t2:Play()
end
end)
In this updated script, the door
variable is declared and assigned before it is used in the TweenService, and the door.Open.Value
is set after the door
variable is assigned. Additionally, the doorname
variable is declared and used to retrieve the correct door
object from the workspace.
1 Like