I’m trying to tell the server where to place a model. The model is in one spot on the client, but on the server, is offset for whatever reason. I’m sending the model’s PrimaryPartCFrame() with GetPrimaryPartCFrame() through a RemoteEvent, like this:
event:FireServer(item:GetPrimaryPartCFrame())
And then, on the server, make a new item and set its CFrame like this:
event.OnServerEvent:connect(function(plr, cframe)
--Pretend item exists for the sake of clarity
item:SetPrimaryPartCFrame(cframe)
end)
I see no reason why the item is offset. I’ve tried just reading the primary part’s CFrame the old-fashioned way (primarypart.CFrame
) to no avail.
Gif of the issue:
https://imgur.com/gallery/PjRXsFO
Help?
1 Like
How big is the offset?
There are known issues with SetPrimaryPartCFrame
offsetting models by a bit.
I made a gif in the OP to show the issue. It’s a significant offset.
I’ve used this method to place items in the past and everything worked like a charm. Don’t know why it isn’t working here…
Did you try comparing sent CFrame and received one?
1 Like
That was a good idea. Unfortunately the CFrame being received is the same as the one being sent.
Here’s my full code. Maybe there’s something here I’m missing?
events:WaitForChild("PlaceItem").OnServerEvent:connect(function(plr, itmname, cframe, pcolor, scolor)
if true then --Add checks here later.
local item = game.ReplicatedStorage.Furniture:FindFirstChild(itmname)
if item then
print(cframe)
item = item:Clone()
item.Colors.PrimaryColor.Value = pcolor
item.Colors.SecondaryColor.Value = scolor
item.PrimaryPart = item.Primary
item:SetPrimaryPartCFrame(cframe)
item.Parent = game.Workspace
end
end
end)
Are you sure that you’re not modifying relative positions on client and that you don’t have two parts called Primary?
1 Like
I changed the primarypart on the server model. Thanks so much!
1 Like