My beam is not my body help pls


when I don’t move the camera my kamehameha works well



if i start moving the camera the beam won’t follow how i can fix it please?

local Meshes = script.Meshes
local Animations = script.Animations
local Sounds = script.Sound

local TweenService = game:GetService("TweenService")
local Debris = game:GetService("Debris")

local AnimCharge = Animations.KameHold

local KamehamehaModule = {}

function KamehamehaModule.Charge(Folder,FolderBeam,Humrp,Player,RightArm,Character,KameHold,KameRelease,Humanoid,FireSound)
	
	KameHold:Play()
	
	local ChargeIn = Meshes.KamehamehaCharge:WaitForChild("In"):Clone()
	ChargeIn.CFrame = RightArm.CFrame * CFrame.new(0,-1.5,0)
	ChargeIn.Size = Vector3.new(0,0,0)
	ChargeIn.Parent = Folder
	
	local ChargeOut = Meshes.KamehamehaCharge:WaitForChild("Out"):Clone()
	ChargeOut.CFrame = RightArm.CFrame * CFrame.new(0,-1.5,0)
	ChargeOut.Size = Vector3.new(0,0,0)
	ChargeOut.Parent = Folder
	
	local weld = Instance.new("ManualWeld")
	weld.Part0 = ChargeIn
	weld.Part1 = RightArm
	weld.C0 = weld.Part0.CFrame:toObjectSpace(weld.Part1.CFrame)
	weld.Parent = weld.Part0

	local weld = Instance.new("ManualWeld")
	weld.Part0 = ChargeOut
	weld.Part1 = ChargeIn
	weld.C0 = weld.Part0.CFrame:toObjectSpace(weld.Part1.CFrame)
	weld.Parent = weld.Part0
	
	local ChargeSound = Sounds.Charge:Clone()
	ChargeSound.Parent = Folder
	Debris:AddItem(ChargeSound,3,5)
	
	TweenService:Create(ChargeIn,TweenInfo.new(3),{Size = Vector3.new(2,2,2)}):Play()
	
	TweenService:Create(ChargeOut,TweenInfo.new(3),{Size = Vector3.new(2.2,2.2,2.2)}):Play()
	
	ChargeSound:Play()
	
	--TweenService:Create(ChargeIn,TweenInfo.new(5),{Size = ChargeIn.Size * 6}):Play()

	--TweenService:Create(ChargeOut,TweenInfo.new(5),{Size = ChargeOut.Size * 6.2}):Play()
	
	Humanoid.WalkSpeed = 0
	Humanoid.JumpPower = 0 
	Humrp.Anchored = true
	--Humanoid.AutoRotate = false
	
	wait(3,5)
	
	ChargeSound:Stop()
	ChargeIn:Destroy()
	ChargeOut:Destroy()
	FireSound:Play()
	KameRelease:Play()
	
	wait(0.5)
	KameHold:Stop()
end

function KamehamehaModule.Fire(Folder,FolderBeam,Humrp,Player,RightArm,Character,KameHold,KameRelease,Humanoid,FireSound)
	
	KameRelease:GetMarkerReachedSignal("Fire"):Connect(function()
	
		local Center = Instance.new("Part")
		Center.CFrame = Humrp.CFrame * CFrame.new(0,0,-4)
		Center.Size = Vector3.new(0.1,0.1,0.1)
		Center.Anchored = true
		Center.CanCollide = false
		Center.CanTouch = true
		Center.Massless = true
		Center.Parent = Folder
		
		local FireIn = Meshes.KamehamehaFire.Front:WaitForChild("In"):Clone()
		FireIn.CFrame = Humrp.CFrame * CFrame.new(0,0,-4)
		FireIn.Size = Vector3.new(5,5,5)
		FireIn.Parent = Folder
		
		local FireOut = Meshes.KamehamehaFire.Front:WaitForChild("Out"):Clone()
		FireOut.CFrame = Humrp.CFrame * CFrame.new(0,0,-4)
		FireOut.Size = Vector3.new(5.2,5.2,5.2)
		FireOut.Parent = Folder
		
		local FireShock = Meshes.KamehamehaFire.Front:WaitForChild("Shock"):Clone()
		FireShock.CFrame = FireOut.CFrame * CFrame.new(0,0,1.5)
		FireShock.Size = Vector3.new(9, 4.8, 9)
		FireShock.Orientation = FireShock.Orientation + Vector3.new(90,0,0)
		FireShock.Parent = Folder
		
		local weld = Instance.new("ManualWeld")
		weld.Part0 = Center
		weld.Part1 = Humrp
		weld.C0 = weld.Part0.CFrame:toObjectSpace(weld.Part1.CFrame)
		weld.Parent = weld.Part0
		
		local weld = Instance.new("ManualWeld")
		weld.Part0 = FireIn
		weld.Part1 = Humrp
		weld.C0 = weld.Part0.CFrame:toObjectSpace(weld.Part1.CFrame)
		weld.Parent = weld.Part0

		local weld = Instance.new("ManualWeld")
		weld.Part0 = FireOut
		weld.Part1 = Humrp
		weld.C0 = weld.Part0.CFrame:toObjectSpace(weld.Part1.CFrame)
		weld.Parent = weld.Part0
		
		local weld = Instance.new("ManualWeld")
		weld.Part0 = FireShock
		weld.Part1 = Humrp
		weld.C0 = weld.Part0.CFrame:toObjectSpace(weld.Part1.CFrame)
		weld.Parent = weld.Part0
		
		local BeamIn = Meshes.KamehamehaFire.Beam:WaitForChild("In"):Clone()
		BeamIn.CFrame = FireIn.CFrame * CFrame.new(0,0,-1)
		BeamIn.Size = Vector3.new(2, 4.671, 4.671)
		BeamIn.Orientation = BeamIn.Orientation + Vector3.new(0,90,0)
		--BeamIn.Anchored = true
		BeamIn.Parent = FolderBeam
		
		local BeamOut = Meshes.KamehamehaFire.Beam:WaitForChild("Out"):Clone()
		BeamOut.CFrame = FireOut.CFrame * CFrame.new(0,0,-1)
		BeamOut.Size = Vector3.new(2.2, 5.465, 5.465)
		BeamOut.Orientation = BeamOut.Orientation + Vector3.new(0,90,0)
		--BeamOut.Anchored = true
		BeamOut.Parent = FolderBeam
		
		local weld = Instance.new("ManualWeld")
		weld.Part0 = BeamIn
		weld.Part1 = FireIn
		weld.C0 = weld.Part0.CFrame:toObjectSpace(weld.Part1.CFrame)
		weld.Parent = weld.Part0

		local weld = Instance.new("ManualWeld")
		weld.Part0 = BeamOut
		weld.Part1 = FireOut
		weld.C0 = weld.Part0.CFrame:toObjectSpace(weld.Part1.CFrame)
		weld.Parent = weld.Part0
		
		for i, v in pairs(FolderBeam:GetChildren()) do
			if v.Name ~= "BeamIn" and v.Name ~= "BeamOut" then
				local goal = {}
				goal.Size = v.Size + Vector3.new(200,0,0)
				goal.CFrame = v.CFrame * CFrame.new(100,0,0)
				goal.Anchored = true
				Humanoid.AutoRotate = false
				local info = TweenInfo.new(6, Enum.EasingStyle.Sine)
				local tween = TweenService:Create(v,info,goal)
				tween:Play()
			end
		end
	end)
end
function KamehamehaModule.Explosion(Folder,FolderBeam,Humrp,Player,RightArm,Character,KameHold,KameRelease,Humanoid,FireSound)
	
	wait(9.5)
	KameRelease:Stop()
	Humanoid.WalkSpeed = 16
	Humanoid.JumpPower = 50 
	Humrp.Anchored = false
	Humanoid.AutoRotate = true

end

return KamehamehaModule

Please provide the script that creates the beam.
(Remember to wrap your code in ``` blocks)

1 Like

I’m going to assume from what you’ve provided that you’re calling from the client to the server to get the direction of your kamehame beam. So if you fire a position but move it’s going to delay the position it was before.

I think to fix this you can stop the player from moving first, then get the position using a remotefunction from the server to client to return your position. After that you can do the rest easy peasy.

1 Like

it’s good I put my script (it’s a module)

you understood but how I will be able to do that I am still a beginner in scripting and also (I put my script look at the top please to see if there are any errors)

So since you’re firing the kamehame on the server you should get the position of where your player is on the server. Now make your player stop moving, and do this next step.

Fire a remotefunction on the client to return your mouse’s location and get the hit position, or whatever you do to make the beam go in the direction of where you’re facing.

Once returned on the server you get that position of where your mouse hit, then you stop the player from moving and make the beam go in the direction of the position you returned.

Pretty sure this is caused by the for loop that loops over all the FolderBeam’s children near the end of the Fire function in the module.

I’m tired and this might be wrong but I’m pretty sure you modifying the size breaks the ManualWelds. (Correct me if I’m wrong).

Are you using LookVector? It is very helpful to determine where to shoot the ray, you can use it to determine the direction which the player is facing.

Other than that, you might want to stop the player from changing their character’s orientation. This post will help - How to stop player movement!

2 Likes

OP welds all the parts to the HumanoidRootPart to move the parts instead of manually modifying cframes. (The weld math handles the direction)

1 Like

local script

local Mouse = Player:GetMouse()
local MousePos = game.ReplicatedStorage:WaitForChild("MousePos") -- or any alternative (mousepos  is a remote function

MousePos.OnClientInvoke = function
           return Mouse.Hit
end

script

local MousePos = game.ReplicatedStorage:WaitForChild("MousePos")

local MouseHit = MousePos:InvokeClient(player)

"BV.Velocity = MouseHit.LookVector * 150 "--I don't know how to do it from there

I can not corrected you I am still a beginner and I want to test your method if you want

Yeah comment out that for loop and see if that fixes the issue and then you can try and move on from there. (You can move the beam on RenderStepped and send a RemoteEvent to all other clients for smooth and efficient movement but that might be too complex for now.)

local MousePos = game.ReplicatedStorage:WaitForChild("MousePos")

local MouseHitCF = MousePos:InvokeClient(player)

if MouseHitCF then
	player.Character.Humanoid.WalkSpeed = 0
	-- cframe player
	Kamehameha.CFrame = MouseHitCF
	for i = 1,100 do
		-- resize kameha
	end
end

Keep in mind this is just an example i’m not going to provide you with the entire code.

1 Like

how can i make a loop?
I am a little lost

Comment out this part of code at the end of Module.Fire function and see if that fixes the issue and then we can try to figure out a solution from there. This code might be breaking the welds you made.

for i, v in pairs(FolderBeam:GetChildren()) do
			if v.Name ~= "BeamIn" and v.Name ~= "BeamOut" then
				local goal = {}
				goal.Size = v.Size + Vector3.new(200,0,0)
				goal.CFrame = v.CFrame * CFrame.new(100,0,0)
				goal.Anchored = true
				Humanoid.AutoRotate = false
				local info = TweenInfo.new(6, Enum.EasingStyle.Sine)
				local tween = TweenService:Create(v,info,goal)
				tween:Play()
			end
		end
1 Like

and it is placed in the local script or in the script?

Looking at your vid again It’s safe to assume you’re having weld issues. When you resize your kameha beam it removes it from the weld. You’ll want to use a WeldConstraint most likely as it’s probably adjusted to not break after being resized.

I’m not entirely sure if WeldConstraints break if you resize a part but I doubt it. So if you just weld & position the beam, then resize it you should have no problem.

Alright, I looked at the video again and found the issue. In the loop at the end of the .Fire function, you modify the CFrame but never use LookVector to make it position to the right direction.

An example of LookVector would be:

local Part = Instance.new("Part")
Part.Parent = workspace
Part.Anchored = true
Part.Position = Vector3.new(0,5,0)

while true do
	Part.CFrame = Part.CFrame + Part.CFrame.LookVector * 5
	wait(1)
end

This will move the part 5 studs in the direction it is facing.

The new for loop code should look like

for i, v in pairs(FolderBeam:GetChildren()) do
	if v.Name ~= "BeamIn" and v.Name ~= "BeamOut" then
		local goal = {}
		goal.Size = v.Size + Vector3.new(200,0,0)
		goal.CFrame = v.CFrame + v.CFrame.LookVector * 100
		goal.Anchored = true
		Humanoid.AutoRotate = false
		local info = TweenInfo.new(6, Enum.EasingStyle.Sine)
		local tween = TweenService:Create(v,info,goal)
		tween:Play()
	end
end


uh what’s the problem this is the first time i meet this

C0 isn’t a property of WeldConstraint. Just adjust your beam’s Position that’s all you need to do.