I have looked at the other asks and saw the solution, however it does NOT work and I get the same error when trying to call localplayer! My localscript is in a gui button btw.
local players = game.Player.LocalPlayer
error: attempt to index localplayer(a nil value)
You forgot to put a S in your script it should be like this
local player = game.Players.LocalPlayer --I changed pllayers to player since this is not the whole group of people--