Oh. Its when a player touches a door. The script fires its just that the tween glitches out. I think because of me doing something wrong. But basicly the thing worked once but not twice
local db = false
local parent = script.Parent
parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and parent.Parent.Owner.Value ~= "nil" and db == false and parent.Parent.Locked.Value == false then
print(hit)
db = true
local properties1 = {
CFrame = script.Parent.Parent.Door2.CFrame
}
local properties2 = {
CFrame = script.Parent.Parent.Door1.CFrame
}
local tweenfo = TweenInfo.new(0.2, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false)
local tween = tweenservice:Create(script.Parent.Parent.Door1, tweenfo, properties1)
tween:Play()
script.Parent.door_open:Play()
wait(0.2)
wait(3)
local tween2 = tweenservice:Create(script.Parent.Parent.Door1, tweenfo, properties2)
tween2:Play()
script.Parent["Door_Close01 (Source)"]:Play()
wait(0.2)
db = false
elseif db == false and hit.Parent:FindFirstChild("Humanoid") and parent.Parent.Owner.Value == hit.Parent.Name then
print(hit)
db = true
local properties1 = {
CFrame = script.Parent.Parent.Door2.CFrame
}
local properties2 = {
CFrame = script.Parent.Parent.Door1.CFrame
}
local tweenfo = TweenInfo.new(0.2, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false)
local tween = tweenservice:Create(script.Parent.Parent.Door1, tweenfo, properties1)
tween:Play()
script.Parent.door_open:Play()
wait(0.2)
wait(3)
local tween2 = tweenservice:Create(script.Parent.Parent.Door1, tweenfo, properties2)
tween2:Play()
script.Parent["Door_Close01 (Source)"]:Play()
wait(0.2)
db = false
end
end)```
local db = false
if hit.Parent:FindFirstChild("Humanoid") and db == false then
db = true
local name = hit.Parent.Name
if name == script.Parent.Parent.Owner.Value then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
player.IsHome.Value = true
player.PlayerGui.DeleteGui.Enabled = true
local ui = player.PlayerGui:WaitForChild("TP_ui")
ui.BlackoutEvent:FireClient(player)
local plot = script.Parent.Parent
local plotnumber = plot.Plot.Value
wait(1)
for i, v in pairs(game.Workspace.Plots:GetChildren()) do
if v.PlotNumber.Value == plotnumber then
hit.Parent.HumanoidRootPart.CFrame = v.Base.CFrame+Vector3.new(0, 5, 0)
end
end
elseif script.Parent.Parent.Locked.Value == false and script.Parent.Parent.Owner.Value ~= "nil" then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local ui = player.PlayerGui:WaitForChild("TP_ui")
ui.BlackoutEvent:FireClient(player)
local plot = script.Parent.Parent
local plotnumber = plot.Plot.Value
wait(1)
for i, v in pairs(game.Workspace.Plots:GetChildren()) do
if v.PlotNumber.Value == plotnumber then
hit.Parent.HumanoidRootPart.CFrame = v.Base.CFrame+Vector3.new(0, 5, 0)
end
end
end
db = false
end
end)