So, it sounds bit complitcated, but it isn't. What I am trying to do is make coin giver which, probably will work fine but I found out I cant get this one problem solved, I created local which is located to TextBox (You type in the players name you want to give the icon to) and put the name of the local in the coin giving thingy, check script lower.
function start() local input = script.Parent.Parent.Input.Text game.Players.input.leaderstats.Coins.Value = game.Players.input.leaderstats.Coins.Value +5 end script.Parent.MouseButton1Click:connect(start)
Unfortunately, this don't work, any ideas how to fix this?
It's quite simple to do this, all it takes is simple math:
local amountToGive = script.Parent.amount --TextBox where the player puts the amount of cash to give local playerName = script.Parent.player --TextBox where the player types another players' name local submit = script.Parent.submit --TextButton used to submit form to donate cash to player submit.MouseButton1Click:Connect(function() --When clicked local playerToGive = game:GetService("Players"):FindFirstChild(playerName.Text) --Player who receives donation local playerWhoClicked = game.Players.LocalPlayer --Player who wants to donate if playerToGive then --If the player we typed in is actually there if playerWhoClicked.leaderstats.Cash.Value >= amountToGive.Text then --If the player who wants to donate has enough cash playerToGive.leaderstats.Cash.Value = playerToGive.leaderstats.Cash.Value + amountToGive.Text --Give cash to player playerWhoClicked.leaderstats.Cash.Value = playerWhoClicked.leaderstats.Cash.Value - amountToGive.Text --Subtracts the cash from the player who donated end end end)
Just make sure this is in a LocalScript so LocalPlayer can be indexed! Hierarchy here. Please accept my answer if this helped!