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

try printing print(script.Parent.Parent.PlayerName.Text)

@smuffgahmin hey can u send me the .rbxl so I can debug with you? I’m guessing you left for the day.

1 Like

Thats actually the other way around. When you are typing in a textbox, the client only sees that, and the server can’t. It will have to be in a local script, with a remote event where the server does the money transfer. The reason why he got the error is because the server still saw just empty space in the textbox, because the client was changing it

Ok, I guess we need to use a remote event @DarkDanny04 so This event needs to be heavily protected. Otherwise, the admin will be abused.

1 Like

I’m back now just took a little break, Here is the .rbxl Gui.rbxl (29.0 KB)

1 Like

Ok, so do you know about remote events? Also the script needs to be in a localscript.

2 Likes

I know what a remote event is and does, but I’m not experienced with them, and yea I was looking at what you guys were saying.

1 Like

Ok, I’m fixing this in studio, give me a couple of mins.

2 Likes

Ok eufhyoiuaefyoieusfhoiseuafh (30)

@smuffgahmin Gui.rbxl (29.6 KB) finished fixing, its not erroring, try this out BTW, its probably not best to keep the admin gui in starter gui. It’s better to keep it in server storage, and then just clone it to the admin players when they join.
If this worked, then go ahead and give me the solution.

2 Likes

I went ahead and manipulated the situation. What I did is I used a remote event to send from the client side “Give” button to connect to the server and transfer over the values. The server received these values and made the changes accordingly. Here is what I was about to put together:

function onClick()
	local FindName = script.Parent.Parent.PlayerName.Text
	script.Parent.Parent.CurrentPlayer.Value = tostring(FindName)
	local FindAmount = script.Parent.Parent.AmountOfPoints.Text
	script.Parent.Parent.Points.Value = tonumber(FindAmount)
	
	local Values = {
		script.Parent.Parent.Points.Value,
		script.Parent.Parent.CurrentPlayer.Value
	}
	game.ReplicatedStorage.CoinGiver:FireServer(Values) --This is a remote event I created which is transferring the table of values.
end

script.Parent.MouseButton1Click:Connect(onClick)

This is a client sided script inside of the “Give” button.

game.ReplicatedStorage.CoinGiver.OnServerEvent:Connect(function(player, Values)
	local PlayerToGive = game.Players:FindFirstChild(Values[2])
	PlayerToGive.leaderstats.Coins.Value += Values[1]
end)

This will transfer all the values over via a table so the server side can see it and then find what it needs. I also used coins as an example. You may need to change where the leaderstats are targeting to get to your players value you want to change.

2 Likes

Dude that is not a good solution, that could really badly be exploited.

1 Like

I decided to use Bottrader’s advice because I got it working, but I just want to say thanks for the help today! :smiley:

1 Like

Thanks, It works! fiefiufesihu (30 characters)

1 Like