Change A Player's Cash/Point Value From A Gui

Hello Fellow Devs, I am currently trying to script a Gui that will change a players Cash/Points value.
I just don’t know how to approach this and need some help. To give more detail, you are going to put the player’s name into one text box, and the amount of points in the other. When you are done you press the give button and the player name and amount of points will go to a IntValue and StringValue, and then it will give the chosen player the desired amount of points. Here is an image of the gui, it is only visible to the admins of the game which is why I chose to do it like this gui Here is an image of the IntValue and the StringValue explorer Please if you have any advice any help is appreciated, thanks for reading and have a good day!

5 Likes

Ok, you could use leaderstats for this? You want me to write a quick script for this?

3 Likes

I have an existing leaderstat which is just “Points”
and like I said I’m just trying to add to the value from the gui.

2 Likes

Where is this gui stored? (30 chars) I just wanna know this so that way I can actually get a perfect script for you.

2 Likes

script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Points.Value = script.Parent.Parent.AmountOfPoints.Text
game.Players[script.Parent.Parent.PlayerName.Text].leaderstats.Points += Points.Value
end)

1 Like

It is in StarterGui, along with the IntValues, and the open/close gui scripts
startergui

1 Like

Why is a players name an intvalue? Or am I not understanding

1 Like

NOTE: DONT USE A LOCALSCRIPT TO GIVE THE POINTS, INSTEAD USE A SCRIPT.
Once the button has been pushed use a server script to use the code that I gave you.
Also the players name has to be in a stringvalue.

5 Likes

Because when you enter the name in the gui the I want the name entered to be in an IntValue

Thats impossible. A player name is not a number.

1 Like

Oops I meant StringValue my bad

I suggest sticking to string values. Much more simple. Oh

V Since that’s what you meant then nvm lol But you can use Client to Client Remote Event , so it’s not exploitable more or less

2 Likes

I don’t understand why the player name needs to be in a string value, you can just use the Text property in TextBox Also where is this script gonna be placed?

1 Like

Yea I didn’t see realize that, thanks. The script is going to be in the give button

1 Like

use this sdajdhjlasljkdjkl;asdljk (30 chars)

1 Like

Thanks, but there is an issue, I get a error message in OutPut that says " is not a valid member of Players." so the script doesn’t work :confused:

1 Like

umm, did you put anything in the textbox

1 Like

Yes, I put my username, I am trying to debug it now

1 Like

1/2 Are you sure it should be a Script not LocalScript 2/2 Here is a video of the issue

Dude, using a localscript wouldn’t update the thing.

1 Like