So i'm very new to scripting and I don't know anything pretty much. I'm wondering if it's possible to make a frame and inside insert a textbox with no text, and a textbutton with the text "give". What I want to know how to do if how to make it so when I type in a roblox username in the textbox, it checks if that roblox username [roblox player] is in the game and if they are in the game when I click give and their username is in the textbox in the "Wins" stat of leaderstat the stat increases by 1. I hope I said it clear enough to were someone can help me, thanks!
I'll try to help, I'm not sure if this will work though.
01 | local Players = game:GetService( "Players" ) |
02 |
03 | game.Players.PlayerAdded:Connect( function (plr) |
04 | plr.CharacterAdded:Connect( function (chr) |
05 | local chrname = chr.Name |
06 | if chrname = "Nitrolux200" then |
07 | -- Grab Leaderstats, then change the leaderstat for the user by 1. |
08 | end |
09 | end ) |
10 | end ) |
Sorry that I had to cut a bit out, I'm sort of a beginner too, but I hope some of this code helped. I'm pretty sure the script can go in Workspace?
01 | local frame = script.Parent |
02 | local textbox = frame.TextBox |
03 | local textbutton = frame.TextButton |
04 |
05 | game.Players.PlayerAdded:Connect( function (player) |
06 | textbutton.MouseButton 1 Click:Connect( function () |
07 | local findplayer = Player:FindFirstChild(textbox.Text) |
08 | if findplayer then |
09 | findplayer.leaderstats.Coins.Value = findplayer.leaderstats.Coins.Value + 1 |
10 | end |
11 | end ) |
12 | end ) |