Error for lacking capability writeplayer

image
what does this error mean? I don’t understand. Here is my code

local workspace1 = game:GetService("Workspace")
local screen = workspace1:WaitForChild("Screens")
local screen1 = screen:WaitForChild("Screen1")
local surfacegui = screen1:WaitForChild("SurfaceGui")
local textbutton = surfacegui.Frame:WaitForChild("TextButton")
local textlabel = surfacegui.Frame:WaitForChild("TextLabel")
textbutton.MouseButton1Click:Connect(function(player)
	player = game.Players.LocalPlayer
	player.Name = textlabel.name.Value
	textbutton.Visible = false
	local players = game.Players:GetPlayers()
	for i,v in pairs(players) do
		if v.Name ~= player.Name and v:GetRankInGroup(6279576) >=5 then
			game.ReplicatedStorage.Staffregisterbutton1:FireClient(v)
		else
			game.ReplicatedStorage.Claimregisterbutton1:FireClient(player)
		end
	end
end)

You can’t change a Player’s name. I’m not sure if this is the case for DisplayName’s though. Does it give you the same error if you change it to Player.DisplayName = textlabel.name.Value?

Changing their DisplayName will still alter the name above their head.

I don’t want to change the player’s name I just want to copy and paste the player’s name into the value of the stringvalue

Oh, then you need to set the Value to the player’s name, not the other way around.
textlabel.name.Value = player.Name

3 Likes

It works now thank you for helping me!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.