hi hello i am making a game
this is the part where i tell you to forcefully fix my code so here it is:
CLIENT:
--#FUNCTIONS
function checkProfile(playerName)
local xpLVL, description, roundsCompleted = game.ReplicatedStorage.Remotes.Profile.CheckPlayerStats:FireServer(playerName)
script.Parent.profileFrame.XPlevel.Text = "experience level: "..xpLVL
script.Parent.profileFrame.description.Text = description
script.Parent.profileFrame.roundsCompleted.Text = "rounds completed: "..roundsCompleted
end
script.Parent.titlescreen.profile.MouseButton1Click:Connect(function()
checkProfile(game.Players.LocalPlayer.Name)
end)
SERVER:
game.ReplicatedStorage.Remotes.Profile.CheckPlayerStats.OnServerEvent:Connect(function(playerName)
local player = game.Players:GetPlayerFromCharacter(playerName)
if player then
if player:FindFirstChild("xpLVL") and player:FindFirstChild("desc") and player:FindFirstChild("keyboard") and player:FindFirstChild("roundsCompleted") then
return player.xpLVL.Value, player.desc.Value, player.roundsCompleted.Value
else
print(">:(")
end
else
print("[P,SD[GQERWOP[]]GFOQREP[]GM,QAERP[OGMQO[IEWPRGMIQWOPRmfgviopwmRIWGORPmgoip")
end
end)
the problem is that it keeps returning the player stats as nil. for some reason the server wont find the player. i've tried this multiple times before in my other games, and it worked. can y'all please tell me why the error keeps happening? thanks :)
server error: ServerScriptService.Remotes:18: invalid argument #2(string expected, got Instance) client error: Players.L_0ID.PlayerGui.mainGui.main.Core:37: attempt to concatenate string with nil

1 comment
you can make it easier by find first child in game.players