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

Is this script correct?

Im trying to morph a player into a model called "m" It will choose between 8 random players and turn one of them into "m" is this correct?

local m = game.Workspace.Lighting.Michael
local chance = math.random(1,8) 
plr = Game.Players.Player
char = character
if m then
	m.Parent = game.Workspace
	plr.Character = m
	plr.CharacterAppereance = "http://www.roblox.com/michael-myers-item?id=187220666"
end


2 comments

0

I'm not sure if you can directly set the player's character. You also should probably change line 2 to "local chance = math.random(game.Players.NumPlayers)".

0

You can't use character appearance, unless you find a guy who are dressed as michael myers on ROBLOX.

1 answer

✓ Accepted answer

No, sorry. It's not correct :(

  1. Game.Players.Player is absolutely wrong. game.Players:GetChildren() would find all the players, if thats what you want.
  2. You never actually use chance in your script...
  3. Lighting is not in workspace... I assume you mean the service Lighting, and not a model in workspace called lighting?
  4. I would move Micheal into ServerStorage, not Lighting.
  5. I don't know what exactly you were trying to do with line 7...
  6. char = character? The script doesn't know what 'character' is. You must define that character is a property of player, and you don't need to to be a variable.

Other than that, I am not sure what you need to do. I would say...

  1. Use the player table game.Players:GetChildren() and math.random to find a random player: something like math.random(1, #players)
  2. Change the character of that player.

Good luck, and Happy Scripting :) -Antharaziia

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