Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Classic stamper tool local placement not replicating to server?

Asked by 4 years ago

I am on a mission to fix the classic stamper tool and I am very close, only to come to yet another brick wall.

Whenever I attempt to place down a model, the position of the model gets shifted off from where the player was clicking. In fact, it always ends up at the same point in space regardless of the model's rotation and where the player was clicking. Below is an picture of this happening with the classic spikes along with some position data.

https://gyazo.com/b2d50ba523a768a806697bbc928408b7

2, 6, -5 turns to -44, 1.4, -182 on the server
37, 6, -67 turns to -44, 1.4, -182 on the server
-10, 6, 13 turns to -44, 1.4, -182 on the server

Here is the code that deals with the position of the model server side: Note that on line 11 mouseHitInWorld = game.Players.LocalPlayer:GetMouse().Hit.p

if M[ObjectName]:IsA("Model") then
    M.Parent = playerParts;
    M.Name = ObjectName;

    local MParts = M[ObjectName]:GetChildren();

    game.JointsService:CreateJoinAfterMoveJoints();
    for i = 1, #MParts do
        if MParts[i]:IsA("BasePart") then
            MParts[i].Anchored = true;
            MParts[i].CFrame:PointToWorldSpace(mouseHitInWorld);
        end
    end

    game.ReplicatedStorage.DestroyClientObject:FireClient(Player, ObjectName);
end

This issue does not happen when placing down a part, which means once this is resolved with models I will have the stamper tool fixed! Please help me with this.

Answer this question