How to make moving kill part

So I want to make a part thats moves and if you touched it it kills you, but I want it to move like it scales

Like this:

What did I mean, I don’t want it to move like this:

I want it to move like this:

I hope you understand, If someone know I will appriciate their help.
Thanks

2 Likes

So you want it to get bigger and smaller. Use the Size property for that. Also, use .Touched to detect when the part is touched.

2 Likes

For that I’d recommend using Tween Service. It’s used for changing any property smoothly, and in your case, the Size of a part.

3 Likes
local Part = script.Parent
local TweenService = game:GetService("TweenService")

local Settings = TweenInfo.new(	
	1, -- duration of the tween
	Enum.EasingStyle.Elastic, -- how your tween will look
	Enum.EasingDirection.InOut, -- how your tween will play or end
	0, -- amount of repeats
	true -- reverses the tween after it's done
)

local TargetSize = 10 -- amount of studs to add to the part's size

local Goal = {	
	Size = Part.Size + Vector3.FromAxis(Enum.Axis.X) * TargetSize,
	Position = Part.Position + Vector3.FromNormalId(Enum.NormalId.Left) * TargetSize / 2
}

local Tween = TweenService:Create(Part, Settings, Goal)

task.wait(3)
Tween:Play() -- plays the tween

if you want it to scale on both sides… change the goal to this

local Goal = {	
	Size = Part.Size + Vector3.new(TargetSize, nil, nil)
}

if you want to scale it on a different face… change the axis and normalid accordingly
X is Left and Right
Y is Top and Bottom
Z is Front and Back
unless if you changed the orientation…

3 Likes

At the first script it scales on both sides,

This is part when game is not started:

i

And this is when game is started:

Main Game - Roblox Studio 2022-09-04 11.15.01

So it goes like this:

bu

But I want it to go like this:

image

If you know how to fix that I will appreciate your help.
Thanks

1 Like

can you show me the goal part of the script?

1 Like

I just copied your fist script

local Part = script.Parent
local TweenService = game:GetService("TweenService")

local Settings = TweenInfo.new(	
	1, -- duration of the tween
	Enum.EasingStyle.Elastic, -- how your tween will look
	Enum.EasingDirection.InOut, -- how your tween will play or end
	0, -- amount of repeats
	true -- reverses the tween after it's done
)

local TargetSize = 10 -- amount of studs to add to the part's size

local Goal = {	
	Size = Part.Size + Vector3.FromAxis(Enum.Axis.X) * TargetSize,
	Position = Part.Position + Vector3.FromNormalId(Enum.NormalId.Left) * TargetSize / 2
}

local Tween = TweenService:Create(Part, Settings, Goal)

task.wait(3)
Tween:Play() -- plays the tween

try this…

local Goal = {	
	Size = Part.Size + Vector3.FromAxis(Enum.Axis.X) * TargetSize,
	Position = Part.Position + Vector3.FromNormalId(Enum.NormalId.Right) * TargetSize / 2
}

Now it goes like this:

image

im confused… what are you trying to achieve

just mess around with this part

local Goal = {	          -- Axis of the Face you want to Scale --
	Size = Part.Size + Vector3.FromAxis(Enum.Axis.Z) * TargetSize,
	Position = Part.Position + Vector3.FromNormalId(Enum.NormalId.Front) * TargetSize / 2
}                                            -- The Face you want to scale --

here’s a guide

add a decal to the part if you’re having a hard time

But can it go only to one side, like just left not left and right?

yes… im quite sure that’s what my script does

Then try it and you can see that it is not working

what… it scales on one face

Can you send me script of that part, and tell me does it have to be anchor , cancollide and that other things, bc maybe I did something wrong

it’s the same script… i didn’t changed the part when i inserted it

Okay now it is working, thanks