Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is the tween not happening? It prints the player opens/closes gate.

Asked by 4 years ago
local gate = game.Workspace:FindFirstChild("Gate")
local debounce = false

game.Players.PlayerAdded:Connect(function(player)
    local role = player:GetRankInGroup(3736685)
    if role >= 168 then
        player.Chatted:Connect(function(message)
            if message == ":open gate" then
                print("Player commands to open the gate.")
                for i,v in pairs(gate:GetChildren()) do
                    print("A")
                    if v:IsA("Part") and debounce == false then
                        debounce = true
                        local info = TweenInfo.new(3, Enum.EasingStyle.Sine, Enum.EasingDirection.In, false, 0)
                        local tween = game:GetService("TweenService"):Create(v,info,{Position = Vector3.new(v.Position.X,v.Position.Y-15,v.Position.Z)})
                        tween:Play()
                    end
                end
            end
            if message == ":close gate" then
                print("Player commands to close the gate.")
                for i,v in pairs(gate:GetChildren()) do
                    if v:IsA("Part") and debounce == true then
                        debounce = false
                        local info = TweenInfo.new(3, Enum.EasingStyle.Sine, Enum.EasingDirection.In, false, 0)
                        local tween = game:GetService("TweenService"):Create(v,info,{Position = Vector3.new(v.Position.X,v.Position.Y+15,v.Position.Z)})
                        tween:Play()
                    end
                end
            end
        end)
    end
end)

It goes till the print("A").

0
I fixed it. AcrylixDev 119 — 4y

Answer this question