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

Text won't change?

Asked by 9 years ago

Ok, this is starting to drive me insane. So, I'm making a "random card picker" as a test for a game I want to later develop. What happens is there is a blank card template in Lighting (Which I will change to ServerStrorage in the actual game), and a button in starter gui. When the button is clicked, it copies the blank card template into PlayerGui, and picks a random set of values for the card (life points, attack points, name, description, etc.). There was then a script in each actual thing on the card (the actual title, description, attack points displayer, etc.) that would sense when its corresponding value changed, and change its text to the value (so, the title would sense when the title value changed, and change the actual title text to the value). This all work perfectly, in test and in server, however i realized that i made all the text GUI's TextBox's instead of TextLabels (which is bad because you can click and change the text in a text box). So I had to manually change all the text boxes to text labels, and, when I did so, the script inside each stopped working. The values change and such, however the script inside each text GUI that senses the change and changes the text stops working, so when the card gets picked, its just a blank template card. Here are the scripts:

Card Picker (All it does is copy the template to PlayerGui):

game.Lighting:WaitForChild("Card")

function onClicked()
    game.Lighting.Card:Clone().Parent = game.Players.LocalPlayer.PlayerGui
end

script.Parent.MouseButton1Click:connect(onClicked)

Card Randomizer:

p = math.random(1,3)

if p == 1 then
    script.Parent.Attack.Value = 2
    script.Parent.LifePoints.Value = 1
    script.Parent.TitleText.Value = "Spawn Demon"
    script.Parent.SpecialText.Value = "Instant Ready"
    script.Parent.GeneralText.Value = " "
elseif p == 2 then
    script.Parent.Attack.Value = 1
    script.Parent.LifePoints.Value = 3
    script.Parent.TitleText.Value = "Pocket Healer"
    script.Parent.SpecialText.Value = " "
    script.Parent.GeneralText.Value = "Heals 1 life to the Hero per turn"
elseif p == 3 then
    script.Parent.Attack.Value = 3
    script.Parent.LifePoints.Value = 2
    script.Parent.TitleText.Value = "Honored Knight"
    script.Parent.SpecialText.Value = "Loyalty"
    script.Parent.GeneralText.Value = " "
end

Text applier (The broken script):

p = script.Parent.Parent.Attack

p.Changed:connect(function()
    script.Parent.Text = p.Value
end)

NOTE: Where it says "attack" is different depending on the script. There are 5 scripts for the 5 different things, attack, life, 2 descriptions, and title.

Help?

0
tl;dr EzraNehemiah_TF2 3552 — 9y
0
Text applier KenzaXI 166 — 9y
0
Text applier, You declare a local for p...* KenzaXI 166 — 9y
0
Didn't* plz kill me now KenzaXI 166 — 9y

Answer this question