How do I make client-sided object?

Hello, I’ve been trying to fix an issue with laggy spinners and things such like that, and I know it can be fixed by making them client sided, but I’ve tried replicating them before, I’ve watched many tutorials, I’ve read many things, and I still have no clue how to make client sided objects, how do I make client-sided objects?

8 Likes

Hey! Here’s a good post:

1 Like

Client-sided objects would need to be cloned from ReplicatedStorage by a localscript.

Let’s say you have a model, named “Model” in ReplicatedStorage (very creative right?), then you’d have a localscript doing something like:

local LocalModel = game.ReplicatedStorage:WaitForChild("Model"):Clone() -- This clones the object
LocalModel.Parent = workspace

This applies to everything related to creating client-sided objects.

2 Likes

I tried to do this, and everything just vanishes, am I putting the script in a wrong place, or am I just misunderstanding this?

1 Like

Can you specify “vanishes”?
(30 characters)

By vanish I mean the brick is not visible, and I couldn’t find it anywhere in the workspace when playing the game and or running it.

Are you sure the object’s CanCollide property is set to true?

Yes, as well I figured out that the brick group wasn’t being moved into the workspace at all.

Where is the localscript located?

I put in ReplicatedStorage and ServerScriptService, but neither worked.

You cannot have localscript in ReplicatedStorage (a storage for replicated assets where absolutely no code will run) for it to run or ServerScriptService (which only run server scripts). Try putting it in StarterPlayerScripts (to run once when you join the game) or StarterCharacterScripts (to run every time you spawn in, but will stack the clones unless you remove them on death)

1 Like

It works now, however, other people can collide with each other’s objects.

1 Like

They should not. This needs to be in a localscript.

They are though.
[30 Characters]

This is a test where one client clones a part and parents it to workspace.
As you can see, Player1 cannot collide with the part nor see it.

Is it because I have player collisions on?

What are we talking about here? The cloned instance or the characters being able to collide?

What I would do is: Create the part in workspace

Then I would create a folder in StarterGui for client scripts
image

this is the script I have in the client

while true do
	game.Workspace.SpinBlock.Orientation = game.Workspace.SpinBlock.Orientation + Vector3.new(0,5,0)
	wait(0.1)
end

I was thinking players colliding with each other.

Then that’s a completely different matter, also off-topic considering your initial question. Though you would want to check out “Player-Player Collisions”.

1 Like