I want to make some animation game for 3 players (i just set up the character loader)
but i kept getting those error even though i typed in the right username
i tried looking up for chatgpt and roaming around dev forum but its hard to understand
server side loading script
local function load(plr)
local starter = plr.PlayerGui.ScreenGui.main
local name1 = starter.FIRST
local name2 = starter.SECOND
local name3 = starter.THIRD
wait(2.5)
local ID1 = game.Players:GetUserIdFromNameAsync(name1.Text)
local ID2 = game.Players:GetUserIdFromNameAsync(name2.Text)
local ID3 = game.Players:GetUserIdFromNameAsync(name3.Text)
if ID1 then
local OUTFIT1 = game.Players:GetHumanoidDescriptionFromUserId(ID1)
if OUTFIT1 then
game.Workspace.rig1.Humanoid:ApplyDescription(OUTFIT1)
end
end
if ID2 then
local OUTFIT2 = game.Players:GetHumanoidDescriptionFromUserId(ID2)
if OUTFIT2 then
game.Workspace.rig2.Humanoid:ApplyDescription(OUTFIT2)
end
end
if ID1 then
local OUTFIT3 = game.Players:GetHumanoidDescriptionFromUserId(ID3)
if OUTFIT3 then
game.Workspace.rig3.Humanoid:ApplyDescription(OUTFIT3)
end
end
end
game.ReplicatedStorage.load.OnServerEvent:Connect(load)
client side loading script
local gui = script.Parent
local plr = game.Players.LocalPlayer
local main = gui.main
local name1 = main.FIRST
local name2 = main.SECOND
local name3 = main.THIRD
local donate
local start = main.start
local loadbt = main.load
local rmload = game.ReplicatedStorage.load
local donatepanelopen = false
local function load()
rmload:FireServer(plr)
end
loadbt.MouseButton1Click:Connect(load)
From what I know, the server-sided scripts cannot access (what the users have changed) the local UI text.
You should send in the arguments of the UIs’ text in the RemoteEvents.
Also, please keep in mind that you cannot send any of the objects to the server side (it will just appear to be nil), only the server can send objects to the clients.
You should send the text value in the RemoteEvent, not the TextLabel object.
Also, you don’t need to use name*.Text as the text value is already sent in the function.
if the load() function on the server is triggered when the remote event is fired ?
If so, keep in mind that the first argument will always be the player firing the remote, no matter what. Also, your MouseButton1Click connection does not provide the plr argument, so it’ll be nil, just remove it on the client side.
My apologies, I forgot to mention that you don’t need the plr argument in rmload:FireServer
Instead, you should remove the plr as it is already fired as the first argument by default as provided here: RemoteEvent | Documentation - Roblox Creator Hub
The code in the LocalScript should be: rmload:FireServer(name1.Text, name2.Text, name3.Text) and the load function don’t have to pass in the plr argument.
Also, the reason why it said Argument 1 missing or nil is because of that the .MouseButton1Click does not pass any argument, thus it passed in nothing as plr argument.