Creating a beam move

I’m currently helping my friend create a script for a move. It’s a beam that does damage. We got stuck on the beam going from a small red ball to a large beam. The problem I’m having is the CFrame/Position. I have no idea how to smoothly move the CFrame/Position of the part. I had this same problem with Gomu Gomu no Mi abilities for Luffy where his arm stretches forward and I wanted to avoid this problem because someone told me I had to learn some complex stuff. Now its require and in my way.

2 Likes

Have you tried using TweenService? its not as complicated as it looks and it can help changing the CFrame of an object smoothly. Heres an example

local part = script.Parent
local goal = {}
goal.Position = part.Position + Vector3.new(0,10,0)

TS:Create(part, TweenInfo.new(5), goal):Play()

read more here

I’ve actually tried this, and I got an error so I thought I saw something wrong. Ill look into it more and try to figure out why it isn’t working.

1 Like

could you show me the code? and what exactly errored?

Ya I got you.
The error is " ServerScriptService.Issei.Dragon Shot.DragonShotSS:15: attempt to perform arithmetic (add) on nil and Vector3"

local event = game.ReplicatedStorage.IsseiSS.DragonShot.DragonShot
local TS = game:GetService("TweenService")

event.OnServerEvent:Connect(function(plr)
	local Character = plr.Character
	local Humanoid = Character.Humanoid
	local OutterBall = game.ReplicatedStorage.IsseiSS.DragonShot.OutterBall:Clone()
	local InnerBall = game.ReplicatedStorage.IsseiSS.DragonShot.OutterBall.InnerBall:Clone()
	local Animation = script.Animation
	local Anim = Humanoid:LoadAnimation(Animation)
	
	local TI = TweenInfo.new(0.5)
	local OutterBallGoal = {}
		OutterBallGoal.Size = Vector3.new(53.17, 15.369, 15.764)
	OutterBallGoal.Position = OutterBallGoal.Position + Vector3.new(27,0,0)
	
	local OutterTween = TS:Create(OutterBall, TI, OutterBallGoal)
	Anim:Play()
	wait(0.250)
	OutterBall.Parent = Character["Left Arm"]
	OutterBall.CFrame = Character["Left Arm"].CFrame * CFrame.new(0,-1.5,0)
	wait(0.917)
	OutterTween:Play()
	
	
	
	
	
	
end)
1 Like

you tried to move the table OutterBallGoal, did u mean OutterBall?

1 Like

This is the part that errored. You cant use the position of the goal. You have to use an actual instances position (if that makes sense?)

example:

OuterBallGoal.Position = HumanoidRootPart.Position + Vector3.new(27,0,0)

What do you mean? I don’t understand what you’re saying. From what I’m seeing I’m moving the part and using the goal as the goal itself… Could you explain more?

Lemme see if this works right now, If it works i’ll let you know.

1 Like

https://gyazo.com/8b149e8d7d4b080084d85b338c7e58c5

1 Like

Are there any errors? also i recommend making your tweenInfo time longer to see if the tween actually worked

I’m getting 0 errors at all. I set it slower, and its still flying across the map for some reason. It makes no sense-

1 Like

Could i see the code again?

(HVMMMMCFHCHGH)

Not exactly sure what that last part is ehehe-

local event = game.ReplicatedStorage.IsseiSS.DragonShot.DragonShot
local TS = game:GetService("TweenService")

event.OnServerEvent:Connect(function(plr)
	local Character = plr.Character
	local Humanoid = Character.Humanoid
	local OutterBall = game.ReplicatedStorage.IsseiSS.DragonShot.OutterBall:Clone()
	local InnerBall = game.ReplicatedStorage.IsseiSS.DragonShot.OutterBall.InnerBall:Clone()
	local Animation = script.Animation
	local Anim = Humanoid:LoadAnimation(Animation)
	
	local TI = TweenInfo.new(10)
	local OutterBallGoal = {}
		OutterBallGoal.Size = Vector3.new(53.17, 15.369, 15.764)
	OutterBallGoal.Position = OutterBall.Position + Vector3.new(27,0,0)
	
	local OutterTween = TS:Create(OutterBall, TI, OutterBallGoal)
	Anim:Play()
	wait(0.250)
	OutterBall.Parent = Character["Left Arm"]
	OutterBall.CFrame = Character["Left Arm"].CFrame * CFrame.new(0,-1.5,0)
	wait(0.917)
	OutterTween:Play()
	
	
	
	
	
	
end)

idk if this is what you want…

:sweat_smile: i dont see anything wrong with the script. Id probably experiment with the size and position. Maybe decrease the size and position of OutterBallGoal ?

When someone tells you they don’t see a problem with it but its still broken T-T, Ill just play with it and hopefully it works.

1 Like

I have figured out the problem. When I add position to the tween, it uses the position as I want, but doesnt keep it in front of me and moves it all the way back to where it is in the replicated storage

1 Like