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

Why wont my Head of Shrek script work :c?

Script below

game.Players.LocalPlayers = plr --[[ Output says 23:50:30.251 - LocalPlayers is not a valid member of Players ]]
while true do
plr.Character.Head.Mesh.MeshId = "http://www.roblox.com/asset/?id=19999257"
plr.Character.Head.Mesh.TextureId = "http://www.roblox.com/asset/?id=20001023"
plr.Character.Head.Transparency = "0.25"
end

1 answer

If you want everyone to have the mesh and texture ID do this:

-- Make sure this goes into a Script, not LocalScript.
while true do
	for _, plr in pairs(game.Players:GetPlayers())do -- foreach loop as it is also called.
		plr.Character.Head.Mesh.MeshId = "http://www.roblox.com/asset/?id=19999257"
		plr.Character.Head.Mesh.TextureId = "http://www.roblox.com/asset/?id=20001023"
		plr.Character.Head.Transparency = "0.25"
	end
	wait() -- ADD THIS! Without this the game will crash.
end

There is no such thing as LocalPlayers in game.Players, and you have to use foreach loop to apply the things to players.

2 comments

0

I had tried something similar to this, and the game crashed, probably because I forgot the wait() Thanks!

0

Actually, Game.Players.LocalPlayer (no 's') exists, in LocalScripts.

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