I’m trying to make a tween effect for a gui. And when I wrote the code and tested it out, I got an error in the output saying that a screengui named, Gui, was not a valid member of PlayerGui. So I checked the script and the startergui for any misspelling, and there was no misspelling for anything. And here’s the screengui right here and the error:
And here’s the code I used:
game.Players.PlayerAdded:Connect(function(player)
local Frame = player.PlayerGui.Gui.Explode
local ts = game:GetService("TweenService")
local ti = TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out)
local tOut = {BackgroundTransparency = 0}
local createOut = ts:Create(Frame, ti, tOut)
wait(5)
createOut:Play()
end)
Why are you manipulting GuiObjects through a serverscript? Also the solution is very simple.
Just do
local Frame = player.PlayerGui:WaitForChild(“Gui”).Explode
Don’t rely that everything will be replicated to the client when they join. Usually there is a small delay for everything to be set up. Use :WaitForChild() and it should fix the issue.