Why are my models not local?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Local models to each player.
  2. What is the issue? Include screenshots / videos if possible!
    The script I am using does not make the models local for some reason.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I made a topic and followed a script based on what the people said. It still didn’t work.

Local script inside starter player scripts:

local pushplat = workspace.Tower1.PushPlatforms:GetChildren() --Gets models of the folder inside of the workspace tower 1

for _, push in pairs(pushplat) do --loops through models
	push.Parent = game.ReplicatedStorage --makes its new parent the ReplicatedStorage
	local pushclone = push:Clone() --clones the models
	pushclone.Parent = workspace.Tower1.PushPlatforms --puts it back into the folder inside the workspace tower1
end

What is wrong?

Can you verify that this loop is running by putting something like print("pushplat: " .. push.Name) at the beginning of the for loop?

1 Like

Okay so I have added print statements to the code and it prints everything, but it is still not local.

Code:

local pushplat = workspace.Tower1.PushPlatforms:GetChildren()

for _, push in pairs(pushplat) do
	print("pushplat: ".. push.Name)
	push.Parent = game.ReplicatedStorage
	print("Parented to replicated storage")
	local pushclone = push:Clone()
	print("Cloned")
	pushclone.Parent = workspace.Tower1.PushPlatforms
	print("New parent is the folder")
end

By “not local” do you mean it’s not created anywhere or it’s created for every player in the server?

I mean it is not local by each player doesn’t have their own version of the model. So, players are still seeing the same thing.

This is local, you are just running it for every player in the server. the way you are doing it, it runs for everyone because you never run it for a single player.

How would you recommend I do this?

I’m not sure how you want it. whether you want it to only appear if something happens or not, etc.

I just want it so that each player has their own version so that people can still use the model without someone else being able to use it. Does this make sense?

then run the full script for the tower (the moving/using it) inside of a local script and if there are any server things needed, use remote events.

1 Like

This is related with the “Piston” I made for u right?

Yea it is… do you know anything that can help me?

The model should start already stored in replicated storage. A local script will the clone it from replicated storage to workspace.

2 Likes

Adding on to what @JasonSpero said, make the model start located directly inside of ReplicatedStorage. The reason it still shows on the server is because you moved it from the client, so it only moves it, you guessed it, for the client.

To fix this, move the PushPlatforms model to ReplicatedStorage and replace your code with


for _, push in pairs(game.ReplicatedStorage:WaitForChild("PushPlatforms"):GetChildren()) do --loops through models
	local pushclone = push:Clone() --clones the models
	pushclone.Parent = workspace.Tower1.PushPlatforms --puts it back into the folder inside the workspace tower1
end

Hmm so I did something like this and it still isn’t local. I stored the folder of the models inside replicated storage.

Script:

local folderpush = workspace.Tower1.PushPlatforms
local reppush = game.ReplicatedStorage.PushPlatforms:GetChildren()

for _, push in pairs(reppush) do
	local clone = push:Clone()
	clone.Parent = folderpush
end

Did I do something wrong?

your variable for the platforms is reppush, you cloned push

I looped through them and cloned each push and parented them to the folder in the workspace.

anything local will only be played on 1 client unless if you put it in startercharacterscripts and starterplayerscripts if you want to call it by function then send a bindable event to do all this work for u of cloning all the parts and model everything that is not local is from the server

The thing is, this script is already a local script inside the starter player scripts, so I am confused why it is not working.

what do you mean not working it is playing on the client