so whenever i code my UI they just dont work, but i dont see any errors in the script or the console
they just dont work for some reason, its really annoying and is holding me from making my UI’s i dont know if its just me, i tried tweening my UI with the script i wrote the exact same script it did not work
here is the script
local play = script.Parent
local main = game.StarterGui.inventory.inventory
play.MouseButton1Up:Connect(function()
main:TweenPosition(
UDim2.new(0.235, 0, 0.117, 0),
"Out",
"Quad",
1,
false
)
end)
i refrenced everything properly i use the same script for tweening other GUI’s and they worked but this day none of my scripts are working
When you used PlayerGui, did any errors occur? If so please send it here so I can debug it more easily. Can you also send the GUI hierarchy image? Thanks
There’s the error, play button is argumented inside the button, so its basically in PlayerGui, but “main” is argumented inside StarterGui, so, thats the problem, here is a fix:
local player = game:GetService("Players").LocalPlayer or game:GetService("Players").PlayerAdded:Wait()
local playergui = player:WaitForChild("PlayerGui")
local play = script.Parent
local main = playergui:WaitForChild("inventory").inventory -- This is inside your playergui, that will make the tween visible for you when you press play button.
play.MouseButton1Click:Connect(function() -- You argumented a wrong click detection.
if player then -- We check if player is loaded
main:TweenPosition(
UDim2.new(0.235, 0, 0.117, 0),
Enum.EasingDirection.Out, -- I just changed this cause using Enums as strings can yield sometimes, but this is at your election.
Enum.EasingStyle.Quad,
1,
false
)
end
end)