How to change the size of only 1 surface of a part ?
Asked by
7 years ago Edited 7 years ago
I've added in my game a script. When we press the correct key it is supposed to create a beam in front of you that deals damage but there is a problem : I dont know how to change the size of only 1 surface of a part , without using Resize() caus it doesnt work with .Touched event. I tried using Vector3 but im not totally at ease with it. I found how to increase the size properly but the size does not increase in front. For example, if i chose to increase the Front size with Vector3, it also increase Back size. I though about modifying the position but i dont know how to do it.
So, i know that wasnt very simple to understand so, this is what is would like : When it grow (by the loop in the code down below) i would like the beam to always be at the correct position (the beginning just at my wand's position and the end at where i aimed the mouse)
Here is the code :
01 | game:GetService( "ReplicatedStorage" ).Tool.OnServerEvent:connect( function (player, position) |
03 | local tool = game.Workspace [ player.Name ] .WandTool |
05 | local beam = script.Parent |
06 | beam.CFrame = CFrame.new(tool.Emitter.CFrame.p, position) |
09 | beam.Size = beam.Size + Vector 3. new( 0 , 0 , 1 ) |
10 | beam.Position = beam.Position + Vector 3. new( 0 , 0 , 1 ) |