Resizer Script Not Working

It’s giving me errors for this script;

script.Parent.Touched:Connect(function()
	script.Parent.Impact:Play()
	 
	script.Parent.ParticleEmitter.Enabled = true
	for i = 1,100 do
		wait(0.01)
		script.Parent.Size.X = Vector3.new(script.Parent.Size.X) - 0.01
		script.Parent.Size.Y = Vector3.new(script.Parent.Size.Y) - 0.01
		script.Parent.Size.Z = Vector3.new(script.Parent.Size.Z) - 0.01
	end
	wait()
	script.Parent:Destroy()
end)

Vector3.new() is for setting 3 vectors. You can’t set individual ones with an integer. Convert this into one line that sets them simultaneously.

Can I get an solution or correction?

I see what you are trying to do this should work.

script.Parent.Size.X = script.Parent.Size.X - 0.01
script.Parent.Size.Y = script.Parent.Size.Y - 0.01
script.Parent.Size.Z = script.Parent.Size.Z - 0.01
1 Like

You’re probably looking for something like this.

local size = script.Parent.Size --saves you typing
local increment = 0.01 --amount you want to decrease by

script.Parent.Size = Vector3.new(size.X - increment, size.Y - increment, size.Z - increment)

Alternatively, you could scratch this method and utilize something like TweenService.

2 Likes

I believe running that would throw a “X cannot be assigned to” error or something of the sort.