Help fix datareset

Hello i’m making a GUI button to reset character data I made the script but it just wont work can someone have a look at it and help me.

script.Parent.MouseButton1Click:Connect(function()

wait()

game.Players.PlayerAdded:Connect(function(Player)

Gender.Value = “”

Hair.Value = “”

Face.Value = “”

Race.Value = “”

Shirt.Value = “Default”

Pants.Value = “Default”

Wallet.Value = 100000

Welfare.Value = 0

Welfare.MinValue = 0

Welfare.MaxValue = 1

end)

Remove this line maybe

game.Players.PlayerAdded:Connect(function(Player)

Since all you want is the function mousebutton1click, this adds another function

Alright I did that but now in the output it says
" 15:26:12.971 - Players.FOAJah.PlayerGui.Main.Player.settings.sure.sure?.TextButton.Script:3: attempt to index nil with ‘Value’"

Have you defined these values

Make sure that you have

local Gender = script.Parent.Gender --If that was where the gender string value was located

for all of them

Yes now it just says
[Gender is not a valid member of TextButton “Players.FOAJah.PlayerGui.Main.Player.settings.sure.sure?.TextButton”

The variable should be the path to the value, I am not entirely sure where that would be in your case b/c there are no images of that

Ok I redid it what about now

script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.ResetCharacter.OnServerEvent:Connect(function(plr)
game.Players:FindFirstChild().Gender.Value = “”
game.Players:FindFirstChild().Hair.Value = “”
game.Players:FindFirstChild().Face.Value = “”
game.Players:FindFirstChild().Race.Value = “”
game.Players:FindFirstChild().Shirt.Value = “Default”
game.Players:FindFirstChild().Pants.Value = “Default”
game.Players:FindFirstChild().Wallet.Value = 100000
game.Players:FindFirstChild().Welfare.Value = 0
game.Players:FindFirstChild().Welfare.MinValue = 0
game.Players:FindFirstChild().Welfare.MaxValue = 1
plr:Kick(“You have just reset your data rejoin the game.”)
end)
end)

Ah so you have an event there, try this

script.Parent.MouseButton1Click:Connect(function()
   game.ReplicatedStorage.ResetCharacter:FireServer()
end)

" FireServer can only be called from the client"

Ah is this not a client script?
MouseButton1Click won’t work unless it is a client script

Ye now it say
16:09:50.675 - Argument 1 missing or nil

Make sure it is

game.Players:FindFirstChild("Gender")

like that

[Players.FOAJah.PlayerGui.Main.Player.settings.sure.sure?.TextButton.LocalScript:4: attempt to index nil with ‘Value’