I am new to i, v loops and am not sure how I would match up a string (a) to a players name?
game.ReplicatedStorage.Common.OnServerEvent:Connect(function(player, a) if player.leaderstats.Credits.Value >= 100 then player.leadersats.Credits.Value = player.leaderstats.Credits.Value - 100 local plrs = game.Players:GetChildren() for i, v in pairs(plrs) do if a == plrs.Name then local a = -- That player end end end end)
Try this:
game.ReplicatedStorage.Common.OnServerEvent:Connect(function(originalplayer, a) local credits = originalplayer.leaderstats.Credits if credits.Value >= 100 then credits.Value = credits.Value - 100 end for i, player in pairs(game.Players:GetChildren()) do if a == player.Name then local a = player end end end)
the answer might change depending on what "a" is
ummmm im not sure what ur asking but when u detect the remote event there's a parameter called player and thats the player and if ur wanting the name just do player.Name