Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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.

0
Thank you! This was very helpful! iCrestfallen -3 — 6y
Ad

Answer this question