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

Can someone help me with this GUI script please?

Asked by 9 years ago

Ok, I made a GUI to hold the stats of players

I placed it in starter GUIs for now until I figure out were to place it.

I created several different frames to hold other frames.

but we will start with just the one.....

Ok, the main frame is called Stats, it is placed in PlayerStats, inside StarterGui

under Stats I have 5 other frames

One of the frames is called Cash

under cash I have 3 separate frames, one to hold the name of the main cash frame, one to hold gold stats and one to hold silver stats.

inside the frame for silver I have a frame called storage, and a textlabel to show the name.

inside storage I have a Object (NumberValue) to hold the total amount of silver owned.

my program is designed to take that total value and make the textlabel under storage display the same thing so the player can see how much silver they have.

I have tried many different things and nothing is working. I have tried to change the numbervalue to (string to int) everything.

I have tried to place the code in many different locations. nothing is working

can someone have a look at the code and explain why it isn't taking the value and changing the text on the textlable to the value?

it is simple code and should work but it is not....

here is an example of the folders in my studio

StarterGUI PlayerStats (this is the GUi) Stats (this frame holds everything in the GUI) Cash (this frame holds all the cash values) Frame Gold Silver Storage TotalCash (this frame holds the total silver the player owns) TextLabel (this label is meant to display the total amount TextLabel (this label displays silver) Playerstats Class (this frame holds the players class value) Experience (this frame holds the players experience) Infamy/Level (this frame holds the infamy and level information about the player) Kills/Deaths (this frame holds all information on the players kills and deaths) PlayerStats (this is the button to open and close the Gui) StarterPlayer

local Button = script.Parent
Frame = script.Parent.Parent.Stats
Convert = script.Parent.Parent.Stats.Class.Class_Text.Storage

function onClick()


    if 
        Frame.Visible == true then  

            Convert.TextLabel = Convert.Container.Value
    end 
end

Button.MouseButton1Click: connect (onClick)
0
wow the web-page program messed up my format... snipers0076 5 — 9y
0
I have figured out how to change the total, on play mode in the roblox studio but it doesnt work on the server mode. i could still use help.... snipers0076 5 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

On line 11 your not doing anything with TextLabel

If you want to change the text of that textlabel make it

Convert.TextLabel.Text = Convert.Container.Value

Hopefully this helped, full code:

local Button = script.Parent
Frame = script.Parent.Parent.Stats
Convert = script.Parent.Parent.Stats.Class.Class_Text.Storage

function onClick()
    if Frame.Visible == true then 
        Convert.TextLabel.Text = Convert.Container.Value
    end
end

Button.MouseButton1Click:connect(onClick)

References: TextLabel Text Property

If this helped please go ahead and accept this answer.


FIXED CODE WITH AUTO UPDATE

local Button = script.Parent
frame = script.Parent.Parent.Stats
Convert = script.Parent.Parent.Stats.Class.Class_Text.Storage

while true do
    wait(1)
    containervalue = Convert.Container.Value
    wait(1)
end

function onClick()
    if frame.Visible == true then
        Convert.TextLabel.Text = containervalue
    end
end

Button.MouseButton1Down:connect(onClick)

Hopefully that worked

0
sorry for the misunderstanding, the way you put it up is the way i have it on my script. i have tried it many different ways, and i can get to work 1 time now but when the value is changed it will not show the new value. snipers0076 5 — 9y
0
Check the bottom of my answer right above this comment section, I added in the code with a loop to auto update that should work Warfaresh0t 414 — 9y
0
Thanks for the Help. This code still dont run, but i figured out how to get it to work. I placed a local script in each of the frames that i want to change instead of the button that opens the GUI. It works in Play mode but not server mode, now i juat have to figure that out. LoL snipers0076 5 — 9y
Ad

Answer this question