Trying to get the size of a part, not printing correctly

I want to get the size of the part by these if statements.

When It’s at size fourth or it’s supposed to be at fourth and it is supposed to print size then
it prints nil.

                    if mouse.Target.Parent ~= workspace and mouse.Target.Parent:FindFirstChild("Log") then
                        local size
                        local log = mouse.Target.Parent.Log
                        if log.Size.X > 1.25 and log.Size.Y > 10 and log.Size.Z > 1.25 then
                            size = "Full"
                        elseif log.Size ==, 2, 2) then
                            size = "Half"
                        elseif log.Size ==, 2, 1) then
                            size = "Fourth"
                        script.Parent.Log:FireServer(log, size)

Please help

What does size mean? It seems you forgot to explain what size means.

It’s a string that I use for another script.

1 Like

And it’s not that the size of the part is to small or something like that so I don’t know what to do in the moment.

1 Like

Well local size needs to be explained to the computer. A computer does not read your mind. For example

    local size = workspace

WELL, I set the size to the size of the part

local size = nil
work? 30 chars

It’s a placeholder variable. Example:

local placeHolder;
placeHolder = 10

Yes, it is. I couldn’t find the word xd.

1 Like

Add prints in every check and add a final else with a print at the end; see which prints, also try printing the log’s size, some debugging might help us

I have tried some debugging but I’ll do some more!

It prints nil at fourth. again

I suggest not using a global variable as a local variable. It will usually return nil and may break your script or overwrite what it does. However I am not positive about what the consequences are.

If it changes color, then don’t save it as a variable. Replace log with Log or log1. Just a heads up.

log can be found on the math API.


is only part of the math thing; it only gets highlighted on here cause they highlight any word involved, using log is fine however.

Try setting size to

local size = ""

It might prefer you don’t use a blank value.

1 Like

That is true. Just trying not to encourage poor habits as it may be a detriment if OP uses log elsewhere in the script.

Sorry for getting off topic.

1 Like
local size = ""

Didn’t work ):

Becuase you need 30 characters to send a message and some people don’t know what to send so they put 30 chars or 30 characters instead.

1 Like

I fixed it by just using a meshpart instead of a model.