Menu system feedback

Hello, I recently made a new system for my menu. You select a model/creature and it morphs you as it
Also is there a way I can make the models picture appear on a gui?
How does the script look?

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("MorphSupplies"):WaitForChild("Events"):WaitForChild("Fire")
local morphs = ReplicatedStorage:WaitForChild("MorphSupplies"):WaitForChild("Morphs")
local Event = game.ReplicatedStorage:WaitForChild("Respawn")

local Menu = script.Parent
local Selected = Menu.Selected
local Cover = Menu.Cover

local MenuFrame = Menu.MenuFrame
local ScrollingFrame = MenuFrame.ScrollingFrame
local TextPart = MenuFrame.TextPart
local Bar = MenuFrame.Bar

local CreaturesText = MenuFrame.CreaturesText
local InfoText = MenuFrame.InformationText
local Desc = MenuFrame.Desc

local Play = MenuFrame.Play
local MButton = Menu.ImageButton

local MenuingText = {"Returning to Menu in: 3","Returning to Menu in: 2","Returning to Menu in: 1"}
local Info = Selected.Value
	
local EnabledMenu = function()
	MButton.Active = false
	Menu.TextLabel.Visible = true
	for i,v in pairs(MenuingText) do
		Menu.TextLabel.Text = (v)
		wait(1)
	end
end

local CoverVis = function()
	local TweenService = game:GetService("TweenService")

	TweenService:Create(Cover,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut),{BackgroundTransparency = 0}):Play()
	wait(1)
end

local CoverDis = function()
	local TweenService = game:GetService("TweenService")

	TweenService:Create(Cover,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut),{BackgroundTransparency = 1}):Play()
	wait(1)
end

MButton.MouseButton1Click:Connect(function()
	if MButton.Active == false then return end
	EnabledMenu()
	CoverVis()
	MButton.Visible = false
	MenuFrame.Visible = true
	MButton.Active = true
	Menu.TextLabel.Visible = false
	local Event = game.ReplicatedStorage:WaitForChild("Despawn")

	Event:FireServer()
	wait(2)
	CoverDis()
end)

Play.MouseButton1Click:Connect(function()
	local CreatureSelected = Selected.Value
	local selectedCreature = morphs:FindFirstChild(CreatureSelected)
	CoverVis()
	MButton.Visible = true
	MenuFrame.Visible = false
	Play.Visible = false
	Desc.Text = "???"
	Event:FireServer()
	wait(2)
	event:FireServer(selectedCreature)
	CoverDis()
end)

--TweenService:Create(Cover,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut),{BackgroundTransparency = 0}):Play()

Here’s it ingame
https://gyazo.com/b131a010f033fa43cec133f4e23682f4
https://gyazo.com/9dce58b367ebb52c8ac7720f948a3816
I will be adding descriptions maybe later at the information tab, I want the models picture to appear here though if possible
image

1 Like

I think a ViewportFrame could help you there

something i suggest is changing the wait() to task.wait() instead as its better overall compared to wait()

You should look for an alternative to wait(), Since it yields the code to much.

Which one? Or do you mean all of them? (char limit)

task.wait() is more superior to wait()
also this line of code

local CoverDis = function()
	local TweenService = game:GetService("TweenService")

	TweenService:Create(Cover,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut),{BackgroundTransparency = 1}):Play()
	wait(1)
end

could be this instead

local CoverDis = function()
	local TweenService = game:GetService("TweenService")

	local tween = TweenService:Create(Cover,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut),{BackgroundTransparency = 1})
	tween:Play()

tween.Completed:Wait() --[[
This line yields the script similarly to task.wait() & wait, but it takes the time 
it'll take to complete the tween into account so this is more recommendable
as you can change the value if you personally think its too short or long 
]]--
end
1 Like