This would be simple, use the Players:GetPlayers() function, and nest it into an array. If you'd like to access them you should use a for loop, and add a Conditional Statement to rule out every other player.
You can also pass the LocalPlayer's name and use it as a parameter for an argument, yet I think this would all be unnecessary as Firing the Server will pass whoever Fired the Remote, as you already have written, but if you'd like to work with a different player, sent from the Remote? then it would look somewhat like so
RemoteEvent.OnServerEvent:Connect(function(FiredPlayer, LocalPlayer)
local Players = game:GetService("Players"):GetPlayers()
for Index, Player in ipairs(Players) do
if (LocalPlayer == LocalPlayer and LocalPlayer.Character) then
print(LocalPlayer.."!")
end
end
end)
You can also write it in this form too.
RemoteEvent.OnServerEvent:Connect(function(FiredPlayer, LocalPlayer)
local Players = game:GetService("Players"):GetPlayers()
local Player = nil
local function CheckForPlayer (Player)
for Index, Player in ipairs(Players) do
if (LocalPlayer.Name ~= LocalPlayer and not LocalPlayer.Character) then
return false
end
Player = Player
return true
end
end
if (CheckForPlayer("JxkeBape")) then
print(Player.."!")
end
end)
That's for other terms, but I believe this is what you're probably looking for, this should be mostly done Client-side. You're using some parts in the wrong place, try this?
local Player = game:GetService("Players").LocalPlayer
local PlayerGUI = Player:WaitForChild("PlayerGui")
local TextBox = PlayerGUI:WaitForChild("TextBox")
local Remote = game:GetService("ReplicatedStorage").Remote
TextBox.FocusLost:Connect(function(Return)
if (Return) then
local Text = TextBox.Text
Remote:FireServer(Text)
end
end)
local Remote = game:GetService("ReplicatedStorage").Remote
local TextLabel = workspace:WaitForChild("TextLabel")
Remote.OnServerEvent:Connect(function(Player, Text)
TextLabel.Text = Text
end)
Hope this helps, I do suggest finding another method but If these work for you too then that's perfect! Good Luck
1 comment
It didn't work because I said worksapce;) try again