How to make a selection work

Basically what I want to do is when you press on a character through the character UI you would then get the stats of that character, which I have made the scripts for.

I’m not sure how to get this to work, all suggestions would be appreciated and tried.

Please clarify… How are you displaying the character in the “Character UI”? Are you getting their thumbnail from Players:GetUserThumbnailAsync() or are you rendering them in a Viewport Frame?

For e.g


Witches:
Vampires:.

(characters would be put here in like a image button, then when you press the character and continue you would then become that character morph and play the game, although not sure how I would make the stats. unless i do that with the script)

The API Reference can help with figuring out which events to use for this kind of thing.

I believe the click event you’re looking for is: GuiButton | Roblox Creator Documentation

(post marked for deletion for privacy reasons)

1 Like

Nope, what I’m meaning is there is a lot of characters with different stats, I want if they press the image button their stats are passed on to their character.

You can do this through a viewport frame of the character, and then a button that fires a remote event to let the server know that you need to change your stats, because you can’t change them via the client.
Something like this:
(Local Script in any Button, only have to put this in once)


local RemoteEvent = game.ReplicatedStorage.RemoteEvent -- make a new remote event in Replicated Storage and name it whatever you want change "RemoteEvent" to that
local Player = game.Players.LocalPlayer -- Defining player.
for _,Button in pairs(script.Parent.Parent:GetChildren() do -- Get all buttons
if Button:IsA("TextButton") then -- Make sure it is a text button
Button.MouseButton1Down:Connect(function() -- Whenever you press any button
RemoteEvent:FireServer(Button.Name) -- Make sure to name the button the character you want
end
end) 
end)

Server Script (ServerScriptService)

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player,character)
if player and character then 
local stattogive = player.leaderstats.stat -- Change this to your stat
-- local secondstat = player.leaderstats.secondstat - you can use more stats
if character == "Witches" then
stattogive.Value = 2 -- Change this to how much stats you want
-- secondstat.Value = 1 - if you want a second stat
elseif character == "Vampires" then
stattogive.Value = 1 -- Change this to how much stats you want
-- secondstat.Value = 1 - if you want a second stat
--elseif character == "somethingelse" then -- more characters?
--tattogive.Value = 1 -- Change this to how much stats you want
-- secondstat.Value = 1 - if you want a second stat
 end
end
end)