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

Resizing a model from client to server?

Asked by 2 years ago

So I have had a lot of thoughts about this

So Basically

I have a Remote Function which will allow the player to resize things on the client and send it to the server but basically

the only thing I can do here is probably use :GetBoundingBox() or something

but I dont know where to go from there

And the only solution I came up with this was

Send the entire children of the model and use that and create a new model

on the server

to update it

But does anyone know how I would go about resizing a model from client to server?

Any simpler options I am open to

1 answer

Log in to vote
-1
Answered by
NykoVania 231 Moderation Voter
2 years ago
Edited 2 years ago

Use object oriented programing and just change the CFrame or Vector3

Update:

Sorry for misunderstanding, something like this might work?

Script

local function ResizeModel(Model, Scale)
    local primary = Model.PrimaryPart
    local primaryCf = primary.CFrame

    for _, v in pairs(Model:GetDescendants()) do
        if v:IsA("BasePart") then
            v.Size = v.Size * Scale
            if v ~= primary then
                v.CFrame = primaryCf + primaryCf:inverse() * v.Position * Scale
            end
        end
    end
    return Model
end

ResizeModel(game.Workspace.Model, 5)

0
Of course I was going to use Object oriented programming but when resized onto the client how would I know what to size it on the server? do I trust what the client sends and just clone what they sent through the evnet? Overseer_Prince 188 — 2y
0
I dont think you understand my question but a model does not have a size and you cant set a models size the only thing close to that is getboundingbox() Overseer_Prince 188 — 2y
0
I updated my post NykoVania 231 — 2y
0
I got this part right but what I mean is how would I tell the server that I resized it using a remote event when resizing a model Overseer_Prince 188 — 2y
View all comments (7 more)
0
The reason this is so hard is because the model has no absolute size that I can rely on so that when the client sends information to the server to resize the server would have to solely rely on what the client has sent Overseer_Prince 188 — 2y
0
The only way I see it is resize the model ---> send the model to the server side or send the information ---> Sanity check ----> :GetBoundingBox() and create a new model out of it Overseer_Prince 188 — 2y
0
I wish models had a size property that we could edit instead of having just :GetBoundingBox() for it Overseer_Prince 188 — 2y
0
We really only have two options going about this Overseer_Prince 188 — 2y
0
Either 1) Send the model from the client to the server whole and completely trust the server on everything and clone that model (Not the best idea) Overseer_Prince 188 — 2y
0
2) Get the name and size of the children in the model and send it to the server, the server will create a new model entirely using the information and children that the client send ( maybe better) Overseer_Prince 188 — 2y
0
However this is the only thing I could think of unless someone knows any math to do with :GetBoundingBox and knows what to do from there Overseer_Prince 188 — 2y
Ad

Answer this question