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

Is there a new way to create local parts?

Asked by 8 years ago

About a year or so ago, I created a script that would create local parts in a dialog choice as part of the character. I now here there is a way to force the ownership of parts to either the server or the client. How would I do this? And is there a way to make sure only the client can see the parts?

2 answers

Log in to vote
3
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
8 years ago

Yes - there is. It's FilteringEnabled. It's a property in workspace that you can enable. Check out the link for a good article on it.

Basically, changes you make on the client won't be replicated to the server. That means any parts you create on the client will only exist on that particular client.

Once you enabled it, all you need to do is create the part in a local script;

Instance.new("Part", workspace)
0
Oh my gosh, I didn't think it was that simple. I have been using FE for a while now but I though you just couldn't create parts at all with local scripts... Oh how I feel stupid. BobserLuck 367 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

A local part can be created by putting the part into the player's Camera object, located in Workspace. Here is a quick and simple tutorial:

1. Set Up The first thing to do is to insert an anchored 4x1x4 brick into ReplicatedStorage. Next, you need to add a LocalScript into StarterGui. Now you have a brick to copy and a script to copy it.

2. Writing the Code Now that you're set up, open up the LocalScript. The first thing you want to do is use WaitForChild() to ensure the script will not crash if the brick has not loaded yet:

local brick=game.ReplicatedStorage:WaitForChild("Part")

Now we have a variable named brick. Now, we need to declare another variable with a clone of brick:

local brick=game.ReplicatedStorage:WaitForChild("Part")
local newBrick=brick:Clone()

For the final line of this script, we need to add it to the player's Camera object:

local brick=game.ReplicatedStorage:WaitForChild("Part")
local newBrick=brick:Clone()
local camera=Workspace.CurrentCamera
newBrick.Parent=camera

The script is finished! You can learn more about local parts here. I hope this helped!

0
Yep, I did something like that last year. BobserLuck 367 — 8y

Answer this question