I want to open CodeFrame but it’s not working, please help
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Parent.Open.Value == false then
script.Parent.Parent.Open.Value = true
script.Parent.Parent.CodeFrame:TweenPosition(UDim2.new(0.5, -200, 0.5, -150), "InOut", "Sine", 1, true)
else
script.Parent.Parent.Open.Value = false
script.Parent.Parent.CodeFrame:TweenPosition(UDim2.new(0.5, -200, 1.5, -150), "InOut", "Sine",1,true)
end
end)
Add print statements, see if the event fires at all.
It might be that the EasingDirection
and the EasingStyle
are wrong.
They are not strings, they are Enums
.
replace the EasingDirection
string with Enum.EasingDirection.InOut
.
replace the EasingStyle
string with Enum.EasingStyle.Sine
.
And can you specify what’s not working? The animation not playing or nothing at all?
2 Likes
The CodeFrame is not coming when I click the CodeButton.
Have you tested the things I put in my last comment? And are there any errors?
1 Like
YawnMcie
(Yawn)
April 9, 2025, 9:38am
#5
Double check if the frame is visible, and that the Udim2 values are correctly represented.
Unrelated but :TweenPosition is actually deprecated in favour of Tweenservice. Won’t make much of a difference but just an FYI!
You can actually use strings in place of Enums as long as the name matches. Saves a bit of time and looks cleaner in my opinion This is wrong! TIL that enum references aren’t actually strings, embarrassing.
2 Likes
FieldMarshal_Abhaas:
"InOut", "Sine"
its not a string its enum you should do something like this
also whoever teached you please dont listen to him again
2 Likes
plz dont spread misinformation
3 Likes
based on the previous replies, the code should look like this (also if this works don’t mark my reply as the solution, mark skelly’s instead)
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0)
local button = script.Parent
local CodeUI = button.Parent
local CodeFrame = CodeUI.CodeFrame
local Open = CodeUI.Open
local tween = nil
button.MouseButton1Click:Connect(function()
if Open.Value == false then
Open.Value = true
if tween ~= nil then
tween:Cancel()
tween = nil
end
tween = TweenService:Create(CodeFrame, tweenInfo, {Position = UDim2.new(0.5, -200, 0.5, -150)})
tween:Play()
else
Open.Value = false
if tween ~= nil then
tween:Cancel()
tween = nil
end
tween = TweenService:Create(CodeFrame, tweenInfo, {Position = UDim2.new(0.5, -200, 1.5, -150)})
tween:Play()
end
end)
1 Like
YawnMcie
(Yawn)
April 9, 2025, 10:30am
#9
Thanks for calling me out, I could’ve sworn that was the case but research tells me that I’m totes wrong. TIL, preciate it!
(Sorry OP!)
1 Like
YSH122331
(JustYSH)
April 9, 2025, 10:34am
#10
i hope i helped
--//Service
local TweenService = game:GetService("TweenService")
--//Function
local function Tween(Instance: Instance, TweenInfo: TweenInfo, PropertiesTable: {any})
return TweenService:Create(Instance, TweenInfo, PropertiesTable)
end
--//Variables
local Button = script.Parent
local Open = Button.Parent.Open
local CodeFrame = Button.Parent.CodeFrame
local TweenVariable = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, true)
--//Main
Button.MouseButton1Click:Connect(function()
if not Open.Value then
Open.Value = true
Tween(CodeFrame, TweenVariable, {Position = UDim2.new(0.5, -200, 0.5, -150)}):Play()
else
Open.Value = false
Tween(CodeFrame, TweenVariable, {Position = UDim2.new(0.5, -200, 1.5, -150)}):Play()
end
end)
2 Likes
96YCY6ABHAAS
(FieldMarshal_Abhaas)
April 9, 2025, 10:36am
#11
It is still not working but thanks for the assistance
but are there any errors in the output? if not, did u make sure that CodeFrame’s Visible
property is set to true?
96YCY6ABHAAS
(FieldMarshal_Abhaas)
April 9, 2025, 10:38am
#13
In output it says it is working but in game it’s not showing
i see. your code for the button makes it so that CodeFrame moves, but not making it visible. i suggest turning Visible
on and move CodeFrame’s Position
to 0.5, -200, 1.5, -150
basically, you say “it’s not working” because CodeFrame is invisible
1 Like
but if u purposely turned it off, make it so that the script also toggles Visible
1 Like
96YCY6ABHAAS
(FieldMarshal_Abhaas)
April 9, 2025, 10:44am
#17
Okay I tried, it is still not showing, I think it is corrupted or something idk
can you provide a screen recording?
1 Like
96YCY6ABHAAS
(FieldMarshal_Abhaas)
April 9, 2025, 10:46am
#19
-Visibile is true
-No errors are showing in the output
-All the names are correct and checked thrice
-Code is correct
Try checking how the properties of the frame is changing after you clicked the button.
2 Likes