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

Why isn't this LocalScript recognising "PlayerScripts"?

I'm working on a system that when you click a player with the tool equipped, it changes a value in their PlayerScripts folder.

I feel like I've made a stupid mistake but I've tried almost everything and I can't get it to work. All the errors are PlayerScripts is not a valid member of Player.

My game is not filtering enabled, and the lines of code are in a LocalScript.

script.Parent.Equipped:connect(function(m)
	m.Button1Down:connect(function()
		local humanoid=m.Target.Parent.Humanoid
		if humanoid then
			local plr=game.Players:GetPlayerFromCharacter(humanoid.Parent)
			if plr.PlayerScripts.CuffingSystem.Cuffed.Value==false then
				plr.PlayerScripts.CuffingSystem.Cuffed.Value=true
			else
				plr.PlayerScripts.CuffingSystem.Cuffed.Value=false
			end
		end
	end)
end)

3 comments

0

you can't make changes to another player. Try using remotes

0

Thank you so much, really helped.

0

yeah i didn't think about that

1 answer

`plr:WaitForChild"PlayerScripts"`` Gotta use waitforchild since objects aren't added in instantly.

1 comment

0

That doesn't work. Just says infinite yield possible, as if it was looking for PlayerScripts when they aren't there.

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