im making a simple tween script that takes a frame and tweens it’s position, but its not working. here’s my code:
-- Variables --
local player = game.Players.LocalPlayer
local playerGui = game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui')
local CHAT = game:GetService("Chat")
local Start = script.Parent.Start
local End = script.Parent.End
wait(5)
local questions = playerGui.V3.Questions:GetChildren()
local Fader = playerV3.Fader
-- Setup --
local q = {}
for i=1,#questions do
table.insert(q, questions[i])
end
-- Start --
Start.B1.MouseButton1Click:Connect(function()
Fader:TweenPosition(UDim2.new(0,0,0,0), "Out", "Quad", 0.5, true)
wait(0.5)
Fader:TweenPosition(UDim2.new(0,0,1,0), "Out", "Quad", 0.5, true)
Start.Visible = false
q[2].Visible = true
end)
-- Main --
for i=2, #q do
q[i].TextBox.FocusLost:Connect(function()
local message = q[i].TextBox.Text
local filteredMessage = CHAT:FilterStringForBroadcast(message, player)
q[i].TextBox.Text = filteredMessage
end)
q[i].B1.MouseButton1Click:Connect(function()
Fader:TweenPosition(UDim2.new(0,0,0,0), "Out", "Quad", 0.5, true)
wait(0.5)
Fader:TweenPosition(UDim2.new(0,0,1,0), "Out", "Quad", 0.5, true)
q[i + 1].Visible = true
q[i].Visible = false
end)
q[i].B2.MouseButton1Click:Connect(function()
Fader:TweenPosition(UDim2.new(0,0,0,0), "Out", "Quad", 0.5, true)
wait(0.5)
Fader:TweenPosition(UDim2.new(0,0,1,0), "Out", "Quad", 0.5, true)
if q[i].Name == 'F1' then
Start.Visible = true
q[i].Visible = false
else
q[i - 1].Visible = true
q[i].Visible = false
end
end)
q[i].B3.MouseButton1Click:Connect(function()
q[i].TextBox.Text = ""
end)
end
any idea why?