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

How to make my script by using instance.new(with local script) onto the player torso?

So i want to put a mesh id part on to a player so when the player moves the part moves with it, kind of like a backpack:

playn = game.Players.Name
part = Instance.new("Part",game.Workspace)
game.Workspace.playn.torso.part.meshid = http://www.roblox.com/asset/?id=1527559

1 answer

  1. You cannot reference a player that way. Since you're using a LocalScript, you have to use game.Players.LocalPlayer

  2. Capitalize what needs to be capitalized. I’m pretty sure “torso” will be invalid; however, “Torso” will not. You’re also missing some things while you’re trying to get to the MeshId.

  3. I highly suggest that you use local variables instead of global if you don’t need your global variables. To do that, you just have to have “local” before your variable name.

local player = game.Players.LocalPlayer
local part = Instance.new("Part",player.Character.Torso)
local mesh = Instance.new("Mesh",part)
mesh.MeshId = "http://www.roblox.com/asset/?id=1527559"

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