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

Can someone give me an explanation on what localparts are?

Asked by 8 years ago

What are they? What do they do? I've heard of them before, but never thought to get into them. How do I create a localpart?

2 answers

Log in to vote
1
Answered by
4Bros 550 Moderation Voter
8 years ago

Local parts are parts that are created on your client and aren't propagated back to the server . Only you can interact with those parts and access their properties, they are hidden from the server and another player's client.

local parts can be created by Instancing a new part and parenting them into the Camera, (or Workspace with filtering enabled set to true) or creating a message instance into the character and parenting the part to the message, all via the client (localscript).

-- With Filtering Enabled set to true
repeat wait() until game.Players.LocalPlayer
local part = Instance.new("Part",game.Workspace)

-- Via Camera
repeat wait() until game.Players.LocalPlayer

local container = Instance.new("Camera")
container.Name = "LocalBin"
container.Parent = Workspace

local platform = Instance.new("Part")
platform.CFrame = character.Torso.CFrame * CFrame.new(0, -3, 0)
platform.Anchored = true
platform.Size = Vector3.new(10, 1.2, 10)
platform.Parent = container

-- Via Message instance in Character
repeat wait() until game.Players.LocalPlayer
local character = player.Character 
local bin = Instance.new("Message")
bin.Name = 'LocalBin'
bin.Parent = character
local part = Instance.new("Part",bin)

Ad
Log in to vote
1
Answered by 8 years ago

Local Parts are parts that are rendered locally via the persons computer, if a part is not local its rendered by the server but if its local its rendered by your computer which makes it significantly faster. Now local parts are parts rendered by your computer only and they interact only with you. There are currently 2 ways of creating a local part which is putting the local part in a message thats childed to a persons humanoid model. This message must be local aswell and created by a local script. The second way is putting the part in CurrentCamera which is a preset local part.

Answer this question