Why doesn't this work?

I’m trying to make a GUI not show if a value is true, but it won’t hide the GUI.

Local Script which handles the GUI tweens:
(in StarterPlayerScripts)

game.Players.LocalPlayer.CharacterAdded:Connect(function()
	if player:FindFirstChild("GoneThroughWelcome").Value == true then
		player.PlayerGui.Welcome:Destroy()
	end
		TweenBlur:Play()
		TweenBlur.Completed:Connect(function()
		game.Players.LocalPlayer.PlayerGui.Welcome.Frame.Academy.Visible = true
		game.Players.LocalPlayer.PlayerGui.Welcome.Frame.Welcome.Visible = true
		local welcomelblinfo = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
		local wgoal = {TextTransparency = 0}
		local wlb = TweenService:Create(game.Players.LocalPlayer.PlayerGui.Welcome.Frame.Welcome, welcomelblinfo, wgoal)
		local academylblinfo = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
		local agoal = {TextTransparency = 0}
		local albl = TweenService:Create(game.Players.LocalPlayer.PlayerGui.Welcome.Frame.Academy, academylblinfo, agoal)
		wlb:Play()
		wait(1)
		albl:Play()
		wait(1.5)
		game.Players.LocalPlayer.PlayerGui.Welcome.Frame.Play.Visible = true
		game.Players.LocalPlayer.PlayerGui.Welcome.Frame.Shop.Visible = true
		local playbtninfo = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
		local pgoal = {TextTransparency = 0}
		local pbtn = TweenService:Create(game.Players.LocalPlayer.PlayerGui.Welcome.Frame.Play, playbtninfo, pgoal)
		pbtn:Play()
		wait(.5)
		local shopbtninfo = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
		local sgoal = {TextTransparency = 0}
		local sbtn = TweenService:Create(game.Players.LocalPlayer.PlayerGui.Welcome.Frame.Shop, shopbtninfo, sgoal)
		sbtn:Play()
		local charbtninfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
		local chargoal = {TextTransparency = 0}
		local cbtn = TweenService:Create(game.Players.LocalPlayer.PlayerGui.Welcome.Frame.Character, charbtninfo, chargoal)
		
	end)
end)

setup script in server script service:

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function()
	if Player:FindFirstChild("GoneThroughWelcome").Value == true then
	Player.Character.HumanoidRootPart.CFrame = game.Workspace.InvisPart.CFrame
			Player.PlayerGui:WaitForChild("Welcome"):Destroy()
		if Player:FindFirstChild("GenderAnims").Value == "Female" then
			local AnimationTracks = Player.Character.Humanoid:GetPlayingAnimationTracks()
			-- Stop all playing animations
			for i, track in pairs (AnimationTracks) do
				track:Stop()
			end
			local animate =	Player.Character:FindFirstChild("Animate")
			animate.run.RunAnim.AnimationId = "rbxassetid://9438134768"
			animate.idle.Animation1.AnimationId = "rbxassetid://9750337322"
			animate.idle.Animation2.AnimationId = "rbxassetid://9750337322"
			animate.walk.WalkAnim.AnimationId = "rbxassetid://9438134768"
			Player.PlayerGui.Settings.Frame.Visible = true
		elseif Player:FindFirstChild("GenderAnims").Value == "Male" then
			local AnimationTracks = Player.Character.Humanoid:GetPlayingAnimationTracks()
			-- Stop all playing animations
			for i, track in pairs (AnimationTracks) do
				track:Stop()
			end
			local animate =	Player.Character:FindFirstChild("Animate")
			animate.run.RunAnim.AnimationId = "rbxassetid://9741977712"
			animate.idle.Animation1.AnimationId = "rbxassetid://9752998959"
			animate.idle.Animation2.AnimationId = "rbxassetid://9752998959"
			animate.walk.WalkAnim.AnimationId = "rbxassetid://9741977712"
			Player.PlayerGui.Settings.Frame.Visible = true	
		
			end
		end
	end)
end)

Video of what I mean:

(yes the values are edited on the server, so it’s not an issue there.)
that gui at the end shouldn’t be showing up at all…

Instead of trying to handle it through the value, just set the GUI’s ResetOnSpawn property to false.

1 Like