Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Matchmaking Error? [Cannot Set a Player's Name??]

Here's the script, so I'm taking two players from the server and adding them to a tournament board. I've been getting this error. Please help.

local ss = game:GetService("ServerStorage")
local values = ss:WaitForChild("Values")
local ingame = values:WaitForChild("In-Game")
local display = ingame:WaitForChild("display")
local countdown = ingame:WaitForChild("countdown")

local playerfolder = ss:WaitForChild("PlayerFolder")
local playercount = ss:WaitForChild("PlayerCount")

local tourneyboard1 = workspace:WaitForChild("TournyBoard")
local tourneyboard2 = workspace:WaitForChild("TournyBoardd")
local tourneyboardgui1 = tourneyboard1:WaitForChild("Gui")
local tourneyboardgui2 = tourneyboard2:WaitForChild("Gui")
local tourneyframe1 = tourneyboardgui1:WaitForChild("Frame")
local tourneyframe2 = tourneyboardgui2:WaitForChild("Frame")

while true do
	if playercount.Value >= 3 then
		while true do
			for i = 20,0,-1 do
			display.Value = 'Welcome! The game will begin shortly. Time Left: '..i
			wait(1)
		end
		wait(3)
		display.Value = "Welcome to LukeGabriel's 1 on 1 Basketball Tournament."
		wait(3)
		display.Value = "Starting game..."
		wait(3)
		display.Value = "Adding Players to the Tournament Bracket."
		local players = game.Players:GetChildren()
		math.randomseed(tick())
		local Chosen1 = players[math.random(1,#players)]
		local Chosen2 = players[math.random(1, #players)]
		repeat Chosen2 = players[math.random(1, #players)] until Chosen2 ~= Chosen1
		local player1 = tourneyframe1:WaitForChild("Text001")
		local playerr1 = tourneyframe2:WaitForChild("Text001")
		local player2 = tourneyframe1:WaitForChild("Text002")
		local playerr2 = tourneyframe2:WaitForChild("Text002")
		Chosen1.Name = player1.Text --what would i put here???
		Chosen1.Name = playerr1.Text
		Chosen2.Name = player2.Text
		Chosen2.Name = playerr2.Text
		math.randomseed(tick())
		local Chosen3 = players[math.random(1, #players)]
		local Chosen4 = players[math.random(1, #players)]
		repeat Chosen3 = players[math.random(1, #players)] until Chosen3 ~= Chosen4 or Chosen2 or Chosen1
		local player3 = tourneyframe1:WaitForChild("Text003")
		local playerr3 = tourneyframe2:WaitForChild("Text003")
		local player4 = tourneyframe1:WaitForChild("Text004")
		local playerr4 = tourneyframe2:WaitForChild("Text004")
		Chosen3.Name = player1.Text
		Chosen3.Name = playerr1.Text
		Chosen4.Name = player2.Text
		Chosen4.Name = playerr2.Text
		display.Value = "Game will begin."
	wait(10)
	end
	
	else
		display.Value = "Game does not have enough players. " .. 3 - playercount.Value .. " players needed."
		end
	wait()
end

I've also tried players[Chosen1].Name, but that doesn't work either.

[Error: "The current identity (2) cannot set a Player's name (lacking permission 4)."]

-Luke

1 answer

✓ Accepted answer

You’re trying to change the name of the PLAYER, so you’d get an error because you’re not allowed to change a player’s name.

In lines 39-42, simply reverse the things :

player1.Text = Chosen1.Name

And etc.

This discussion is preserved as it was. New answers, comments, and votes are closed.