1 | game.ReplicatedStorage [ "admin money" ] .OnServerEvent:Connect( function (player,target,money) |
2 | --if player.PlayerGui.rank:FindFirstChild("admin gui") then |
3 | print (target) |
4 | target:WaitForChild( "leaderstats" ).Money.Value = money |
5 | --end |
6 | end ) |
ServerScriptService.admin:73: attempt to call method 'WaitForChild' (a nil value) without waitforchild i got ServerScriptService.admin:73: attempt to index local 'leaderstats' (a nil value)
prints: world_kiIIer
local script since it seems like to be needed (should not be needed)
1 | local player = script.Parent.Parent.player |
2 | local money = script.Parent.Parent.amount |
3 | script.Parent.MouseButton 1 Click:Connect( function () |
4 | for i,v in pairs (game.Players:GetChildren()) do |
5 | if v.Name:match(player.Text) then |
6 | game.ReplicatedStorage [ "admin money" ] :FireServer(v.Name,money.Text) |
7 | end |
8 | end |
9 | end ) |
The target value is just the player's name, instead you should reference the player object:
1 | local player = script.Parent.Parent.player |
2 | local money = script.Parent.Parent.amount |
3 | script.Parent.MouseButton 1 Click:Connect( function () |
4 | for i,v in pairs (game.Players:GetChildren()) do |
5 | if v.Name:match(player.Text) then |
6 | game.ReplicatedStorage [ "admin money" ] :FireServer(v,money.Text) |
7 | end |
8 | end |
9 | end ) |
Or something like this for the server-script, it simply finds any player with that specific name.
1 | game.ReplicatedStorage [ "admin money" ] .OnServerEvent:Connect( function (player,target,money) |
2 | --if player.PlayerGui.rank:FindFirstChild("admin gui") then |
3 | print (target) |
4 | game.Players:FindFirstChild(target):WaitForChild( "leaderstats" ).Money.Value = money |
5 | --end |
6 | end ) |