FOAJah
(FOAJah)
October 15, 2020, 7:19pm
#1
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
FOAJah
(FOAJah)
October 15, 2020, 7:26pm
#3
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’"
FOAJah:
Gender.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
FOAJah
(FOAJah)
October 15, 2020, 7:34pm
#5
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
FOAJah
(FOAJah)
October 15, 2020, 8:04pm
#7
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)
FOAJah
(FOAJah)
October 15, 2020, 8:08pm
#9
" 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
FOAJah
(FOAJah)
October 15, 2020, 8:10pm
#11
Ye now it say
16:09:50.675 - Argument 1 missing or nil
Make sure it is
game.Players:FindFirstChild("Gender")
like that
FOAJah
(FOAJah)
October 15, 2020, 8:21pm
#13
[Players.FOAJah.PlayerGui.Main.Player.settings.sure.sure?.TextButton.LocalScript:4: attempt to index nil with ‘Value’