Hello Developers.
Im making an RP game, that you can play as one of lots of characters that i made…
I took a model made by IDKBlox (https://www.roblox.com/library/1214241595/Character-select)
And I NEED to make it a huge change, but i don’t know how to do it
i need to put ALL the Character changing buttons inside a scrolling GUI that can be closed and opened, all the buttons are premade in the model, so i want to keep them, premade, but in a GUI (ScrollingFrame) that closes and opens. (no, i don’t want to use UIAspectRatioConstraint. Also, i want to add some decorative images to the ScrollingFrame)
Here are the scripts:
LocalScript inside ScreenGUI (Character Select) NOTE: Inside this ScreenGUI are the character buttons
local Characters = game:GetService("ReplicatedStorage").Characters
local Event = game:GetService("ReplicatedStorage").ChooseCharacter
for i,v in pairs (script.Parent:GetChildren()) do
if v:IsA("TextButton") or v:IsA("ImageButton") then
v.MouseButton1Click:connect(function()
if Characters:FindFirstChild(v.Name) then
Event:FireServer(v.Name)
elseif v.Name == "PlayerCharacter" then
Event:FireServer("PlayerCharacter")
end
end)
end
end
Script (Called Read ME) Inside Model (Character Changer)
--[[
characters folder goes in replicated storage
choosecharacter event goes in replicated storage
character select gui goes in startergui
this script goes in ServerScriptService
can add more characters by putting more character models in the characters folder
and in the gui just duplicate the gui move it and change the name of the gui
to exactly the name of the character you put in the characters folder
--]]
local Characters = game:GetService("ReplicatedStorage").Characters
local Event = game:GetService("ReplicatedStorage").ChooseCharacter
Event.OnServerEvent:connect(function(player,character)
if character == "PlayerCharacter" then
player:LoadCharacter()
else
local char = Characters[character]:Clone()
char.Name = player.Name
player:LoadCharacter()
player.Character = char
player.Character.Parent = workspace
end
end)
Here is a screenshot (It helps a lot, see the explorer) As you can see, the character models are inside a folder called Characters (wich is inside ReplicatedStorage. Also, inside ReplicatedStorage there is a event called ChooseCharacter)
What i do for put all toose buttons in a ScrollingFrame that close and open with a button?
I tried placing all the buttons inside a ScrollingGUI without changing any script, but it didn’t worked.
Hope you can solve this problem, and please be patient with me because sometimes takes me really much time to understand scripting Thank you!
EDIT: Sorry if i sometimes say ScrollingGUI instead of ScrollingFrame