This is a very simple question but for some reason I can’t seem to do it. This is what I currently have, which does not work at all and I have no idea why. It’s in it’s own server script so it should not interfere with anything.
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
for i, v in pairs(game.Workspace:GetDescendants()) do
print(v)
if v:IsA("BasePart") then
v:SetNetworkOwner(Player)
end
end
end)
I’m doing this because I want to simulate physics on the client (it’s for a singleplayer game so it doesn’t really matter).
also v doesn’t print at all for a reason i dont know yet
You might need to wait for the client to finish loading first before setting network ownership.
-- LocalScript in StarterPlayerScripts
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local loadedRemote = ReplicatedStorage:WaitForChild("LoadedRemote")
if not game:IsLoaded() then
game.Loaded:Wait()
end
-- We've finished loading at this point
loadedRemote:Fire()
However I don’t believe that setting every single part’s network owner to the player is effective. Roblox should automatically set the network owner if the player gets close enough to a part, but if that’s not enough, I would fire a remote for every physics-enabled part that’s within 30 studs of the player and set the ownership from there.