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

How to name the value?

I'm trying to make an Ad place so people can go there and promote games, groups , shops , gamespassess, you can also make friends and play tick tac toe! But I can't make the ownership value can you please help me, here is my script.

script.Parent.Touched:Connect(function()
	game.Players.LocalPlayer.Name = game.Workspace.Post1.Post.Post.PlayerName.Value
end)

2 answers

Just set the value using

game.Workspace.Post1.Post.Post.PlayerName.Value = game.Players.LocalPlayer.Name

5 comments

0

it says "attempt to index nill with name" I copy and pasted

0

it says "attempt to index nill with name" I copy and pasted game.Workspace.Post1.Post.Post.PlayerName.Value = game.Players.LocalPlayer.Name

0

That means that "PlayerName" doesn't exist.

0

how do I fix it then?

0

Your script probably identified the location wrong.

I suggest using a regular script because you are trying to change a global value.

script.Parent.Touched:Connect(function(player)
 game.Workspace.Post1.Post.Post.PlayerName.Value = player.Name
end)

The issue seems to be that you are trying to get "LocalPlayer" in a global script. "LocalPlayer" can only be indexed in a local script

2 comments

0

I am using a Regular script

0

Then the fact you are using a regular script is the issue. In your previous script you attempted to index "LocalPlayer" in a global script. LocalPlayer can only be found in a local script.

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