Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you make the choices players made remembered in the script?

How do you make the choices players made remembered in the script?

Like, if the game asks you: are you a boy, or a girl?

For example, if you click girl, your choice will be remembered and it will give you a different dressing game than that of the boys. It will also be remembered by the NPCs who will refer to you as "she" or "he".

I'm just wondering about this. Your help will be appreciated.

1 answer

✓ Accepted answer

Set up a blank variable, then modify it accordingly. Following your example, here's a button which saves your gender as a variable:

local GUI = script.Parent -- Assuming the script is inside the GUI
local GirlButton = script.Parent.GirlButton -- Assuming your button is named as so
local BoyButton = script.Parent.BoyButton -- Assuming your button is named as so
local ChosenGender -- Your empty variable

GirlButton.MouseButton1Click:Connect(function()
	ChosenGender = GirlButton.Name
end

BoyButton.MouseButton1Click:Connect(function()
	ChosenGender = BoyButton.Name
end

You can then manipulate the stored ChosenGender variable as you please.

If you wish to use your ChosenGender variable in other scripts, you should use StringValues instead.

1 comment

0

Thank you! This was very helpful!

This discussion is preserved as it was. New answers, comments, and votes are closed.