game.ReplicatedStorage["admin money"].OnServerEvent:Connect(function(player,target,money) --if player.PlayerGui.rank:FindFirstChild("admin gui") then print(target) target:WaitForChild("leaderstats").Money.Value = money --end 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)
local player = script.Parent.Parent.player local money = script.Parent.Parent.amount script.Parent.MouseButton1Click:Connect(function() for i,v in pairs(game.Players:GetChildren()) do if v.Name:match(player.Text) then game.ReplicatedStorage["admin money"]:FireServer(v.Name,money.Text) end end end)
The target value is just the player's name, instead you should reference the player object:
local player = script.Parent.Parent.player local money = script.Parent.Parent.amount script.Parent.MouseButton1Click:Connect(function() for i,v in pairs(game.Players:GetChildren()) do if v.Name:match(player.Text) then game.ReplicatedStorage["admin money"]:FireServer(v,money.Text) end end end)
Or something like this for the server-script, it simply finds any player with that specific name.
game.ReplicatedStorage["admin money"].OnServerEvent:Connect(function(player,target,money) --if player.PlayerGui.rank:FindFirstChild("admin gui") then print(target) game.Players:FindFirstChild(target):WaitForChild("leaderstats").Money.Value = money --end end)