Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is this script correct?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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


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)". GoldenPhysics 474 — 9y
0
You can't use character appearance, unless you find a guy who are dressed as michael myers on ROBLOX. iNicklas 215 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

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

Ad

Answer this question