Im trying to make a button that slides to turn sfx off heres the problem when I click the button the tween won’t play idk why that is act like the function tweening doesnt exist bc I always used that 1 but I only know hot to manupilate the place with that not more like a color my output does print 1 and 3 btw
local TS = game:GetService("TweenService")
local SS = game:GetService("SoundService")
local SFX = SS.SFX:GetChildren()
local Button = script.Parent
local Value = script.Value
local BOn = script.Parent.Parent.ButtonOn
local BOf = script.Parent.Parent.ButtonOff
local Operator = false
local ButtonM = script.Parent.Parent.Button
local info = TweenInfo.new(
1,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0.2,
false
)
local tween = TS:Create(Button, info, {Position = BOf.Position, BackgroundColor3 = BOf.BackgroundColor3})
local function Tweening(button, location)
button:TweenPosition(UDim2.new(location), --position
Enum.EasingDirection.Out, --Direction
Enum.EasingStyle.Linear, --Style
0.2, --Time
false) --again?
end
Button.MouseButton1Up:Connect(function()
print("1")
if Operator == true then
print("2")
print("in sessoion")
elseif Operator == false then
print("3")
SFX.Volume = 0
tween:Play()
wait(0.2)
print("clicked")
end
end)
well I swapped the 2 of them but I got the exact same problem as before the buttons doesnt do anything and the code still runs you were right abt that litlle mistake I made. I made it out of habit too bad it didnt solve the problem
local function Tweening(button, location)
button:TweenPosition(UDim2.new(location), --position
Enum.EasingDirection.Out, --Direction
Enum.EasingStyle.Linear, --Style
0.2, --Time
false) --again?
end
Button.MouseButton1Up:Connect(function()
print("1")
if Operator == true then
print("2")
print("in sessoion")
elseif Operator == false then
print("3")
SFX.Volume = 0
tween:Play()
wait(0.2)
print("clicked")
end
end)
but it prints 3 and clicked so the problem has to be in the tween itself and I dont know why it doesnt work since I never worked with this version of the tweens
Yea but heres the thign I havnt add anythign to that function that would change the operator I alr set the boolvalue of the operator to false thats why it does print “3” and “clicked” I know the problem isnt in the function but it has to be in the tween itself somewhere only I dont know what
Sorry I was online searching for a solution. uhm lets see Im making a button that can slide on and off wiht changing color I set to change these 2 properties of the frame so it makes a nice sliding effect. Only it seems like the tween doesnt run I also tried changing the lcoation to somewhere else and color to a total differenct color nothing happens. I also added multiple breakingpoint in the mousebutton1up function but they all printed. and following to my output the print says it played but there wasnt any movement or clor change
If anything, it could be a problem with your UI or the way you declared them as variables. You could have mixed it up in some way by accident. I recommend that you go through your UI tree and see if you actually got the right UI Object in the first place, make sure you’re tweening the right button etc etc. It could be your button’s visible property is set to false, or it’s position is already at your designated position based on where it was placed. So if you don’t mind, show us your UI hierarchy in StarterGui or wherever you keep it, this might give a better indication as to what the problem actually is. ALSO ALSO, do make sure the UI Objects transparency is at 0, otherwise you will not see any color change. I tried using your script with my own UI and it works perfectly fine. Fiddle around with your stuff there and I’m sure you’ll find a solution. As Timati4Life mentioned, make sure you make an “on” version of the tween otherwise it’ll continuously keep it off
uhm alr heres the thing im dumb ash and you were right I checked or I was changing the button value only I tot forgat I was using a frame for the vision and an transparent imagebutton as button so thats why I didnt see any changes tysm cant believe such a small dumb mistake can cost so much time