If statement with size

So i’m trying to make this obby that when you use a tool an object’s height will increase, so far i have done the tool it works perfectly fine, but i want to make a limit to how high the object can go, in the mean time i have 2 tools one that increases the height and one that decreases the height
This is what i have so far, idk why the recording quality is so bad
robloxapp-20200513-1302368.wmv (3.0 MB)

This is the problem
robloxapp-20200513-1305234.wmv (4.2 MB)

I tried doing this

if test.size == (*insert size here*)  then
test.size =(*insert size here*)
end)

I’m confused, should i use vector 3? Must i put this size in quotation marks?

I’m new to scripting sorry if the answer is simple.

If you want to see the full code tell me.

3 Likes

If you want to detect how high the player is you should use position size won’t work

No i want to detect the size of the part

For the size, the Size property has a capital S and it’s a Vector3 Value, so it will be

if test.Size >= Vector3.new(0,0,0) then -- We also check if it is greater
    -- your code
end

to repeatedly check it, use while true do loop

2 Likes

Yes you have to use vector three

Use the Y component of the Vector3 since we want to check height

I get this error i tried to do what you said a while ago but this error poped up Players.SpacialEthanRB.Backpack.Add.Script:21: attempt to compare userdata

Is it something do with the type of script i’m using?

No. it has to do that you are trying to compare Vector3’s

the position? or did you try the vector3

@LukaDev_0 and @EHGTR1903 Sorry i have no idea what you are talking about.

You should compare the parts Size Y (Part.Size.Y) with the max number if its lower then the max then you can make it bigger if its not then do nothing

what type of script are you using?

part.Size.Y is the height of the part and can you show your script please, to check the problem?

Normal one (30 charcharcharchar)

I made a similar one in my studio and it worked for me. It should also work for you.

1 Like

This is the tool that increases the height

local tool = script.Parent
local test = game.Workspace.Test

tool.Activated:Connect(function()
	test.Size = test.Size + Vector3.new(0, 8, 0)
	game.Workspace.pop:Play()
end)



tool.Equipped:Connect(function()
test.Material = Enum.Material.Neon
test.BrickColor = BrickColor.new("Lime green")
end)

tool.Unequipped:Connect(function()
	test.Material = Enum.Material.Plastic
	test.BrickColor = BrickColor.new("Medium stone grey")
end)

if test.Size.Y == --i have no idea what to put here

use a Vector3 Value like I said

Try putting a part at a certain hight then this

if test.Size.Y == part.Size.Y then
--you code here
end

and put it in a while true do loop

1 Like

wouldn’t work, he has to make it the same height Y size