i think the issue is setnetworkowner - look at my modules being run on the server.
CharacterModule
local module = {}
-- //Services
-- //Modules
local WeldModule = require(script:FindFirstChild("WeldModule"))
function module:create(player, character)
-- //Humanoid
local Humanoid = character:FindFirstChild("Humanoid")
Humanoid.RequiresNeck = false
-- //for loop
for _, part in ipairs(character:GetChildren()) do
if part:IsA("BasePart") then
-- //SetNetworkOwner
part:SetNetworkOwner(player)
end
end
-- //for loop
for a, joint in ipairs(character:GetDescendants()) do
if joint:IsA("Motor6D") then
joint:Destroy()
end
end
WeldModule:weld(player, character)
end
return module
PositionModule
local module = {}
-- //Services
local RunService = game:GetService("RunService")
-- //Tables
local ObjTable = {
Velocity = script:FindFirstChild("BodyPosition"),
Gyro = script:FindFirstChild("BodyGyro")
}
function module:physics(player, character)
-- //for loop
for b, part in ipairs(character:GetChildren()) do
if part:IsA("BasePart") and string.match(part.Name, "Arm") or string.match(part.Name, "Head") then
-- //for loop
for index, obj in pairs(ObjTable) do
-- //Clone
local Clone = obj:Clone()
-- //
if not part:FindFirstChild(obj.Name) then
Clone.Parent = part
end
-- //
end
-- //
end
end
end
return module
Client Script
-- //Services
local VRService = game:GetService("VRService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Camera = workspace.CurrentCamera
local RunService = game:GetService("RunService")
-- //Folders
local RemoteEvents = ReplicatedStorage:FindFirstChild("RemoteEvents")
-- //Remotes
local VREnabled = RemoteEvents:FindFirstChild("VREnabled")
-- //Character
local character = script.Parent
-- //Player
local player = Players:GetPlayerFromCharacter(character)
-- //BaseParts
local Head = character:FindFirstChild("Head")
local RightArm = character:FindFirstChild("Right Arm")
local LeftArm = character:FindFirstChild("Left Arm")
-- //
if VRService.VREnabled then
player.CameraMode = Enum.CameraMode.LockFirstPerson
VREnabled:FireServer()
end
-- //Body
local BodyPosHead = Head:FindFirstChild("BodyPosition")
local BodyGyroHead = Head:FindFirstChild("BodyGyro")
local BodyPosRightArm = RightArm:FindFirstChild("BodyPosition")
local BodyGyroRightArm = RightArm:FindFirstChild("BodyGyro")
local BodyPosLeftArm = LeftArm:FindFirstChild("BodyPosition")
local BodyGyroLeftArm = LeftArm:FindFirstChild("BodyGyro")
if BodyPosHead or BodyGyroHead or BodyPosRightArm or BodyGyroRightArm or BodyPosLeftArm or BodyGyroLeftArm then
print("Body Loaded!")
end
-- //
if VRService.VREnabled then
RunService.RenderStepped:Connect(function(deltaTime: number)
-- //VR
local HeadVR = VRService:GetUserCFrame(Enum.UserCFrame.Head)
local RightVR = VRService:GetUserCFrame(Enum.UserCFrame.RightHand)
local LeftVR = VRService:GetUserCFrame(Enum.UserCFrame.LeftHand)
Head.CFrame = Camera.CFrame * HeadVR * BodyGyroHead.CFrame + BodyPosHead.Position
RightArm.CFrame = Camera.CFrame * RightVR:ToWorldSpace(CFrame.Angles(math.rad(90), 0, 0)) * BodyGyroRightArm.CFrame + BodyPosRightArm.Position
LeftArm.CFrame = Camera.CFrame * LeftVR:ToWorldSpace(CFrame.Angles(math.rad(90), 0, 0)) * BodyGyroLeftArm.CFrame + BodyPosLeftArm.Position
-- //for loop
for _, child in ipairs(character:GetChildren()) do
if child:IsA("BasePart") and child.Name ~= "Head" then
child.LocalTransparencyModifier = 0.75
end
end
end)
end
the body instances are getting registered but idk why its not replicating. i took off setnetworkown on the server to test if it would work and it still doesnt.
TL;DR: Make sure that every part of the body has network ownership set to the player.
It’s possible that when you’re removing welds it resets the assemblies’s network ownership to the server. Maybe set the ownership after making modifications.
If the client has ownership of all the parts, the parts are unanchored on both the client and the server, the physics from the client should always replicate.
Edit:
Also, this statement should use ands, so that it prints only if everything is loaded, instead of only one thing.
Oh, I think I see the problem. Are you controlling the body parts with physics (ie the body movers) or are you controlling them by setting the CFrame directly?
I believe instead of the lines above, you should be setting the control properties of the respective body movers. Setting CFrames isn’t physics based, and network ownership is for replicating physics updates.
i tried this on each arm and head now the server is replicating
the client was handling it but not replicating now its showing what the server is doing
its staying in its given bodyposition = 0 on the vector and the cframe isnt working
-- //
if VRService.VREnabled then
RunService.RenderStepped:Connect(function(deltaTime: number)
-- //VR
local HeadVR = VRService:GetUserCFrame(Enum.UserCFrame.Head)
local RightVR = VRService:GetUserCFrame(Enum.UserCFrame.RightHand)
local LeftVR = VRService:GetUserCFrame(Enum.UserCFrame.LeftHand)
local headCFrame = Camera.CFrame * HeadVR * BodyGyroHead.CFrame + BodyPosHead.Position
BodyPosHead.Position = headCFrame.Position
BodyGyroHead.CFrame = headCFrame
local rightCFrame = Camera.CFrame * RightVR * BodyGyroRightArm.CFrame + BodyPosRightArm.Position
BodyPosRightArm.Position = rightCFrame.Position
BodyGyroRightArm.CFrame = rightCFrame
-- //for loop
for _, child in ipairs(character:GetChildren()) do
if child:IsA("BasePart") and child.Name ~= "Head" then
child.LocalTransparencyModifier = 0.75
end
end
end)
end
you solved it - it was the joints being broken after the parts were being setnetworkowner, so i swapped the for loops around.
UPDATED CHARACTERMODULE
local module = {}
-- //Services
-- //Modules
local WeldModule = require(script:FindFirstChild("WeldModule"))
function module:create(player, character)
-- //Humanoid
local Humanoid = character:FindFirstChild("Humanoid")
Humanoid.RequiresNeck = false
Humanoid.HipHeight = 2
-- //for loop
for a, joint in ipairs(character:GetDescendants()) do
if joint:IsA("Motor6D") then
joint:Destroy()
end
end
-- //for loop
for _, part in ipairs(character:GetChildren()) do
if part:IsA("BasePart") then
-- //SetNetworkOwner
part:SetNetworkOwner(player)
end
end
WeldModule:weld(player, character)
end
return module