How to fix this?

Hey! I am trying to make this go to the front of the character not being in the middle any ideas how?
Pictures:

script for it

weld = true
game.ReplicatedStorage.EVENTS.LightBeam.OnServerEvent:Connect(function(p)
	
	plr = workspace[p.Name]
	
	 beam1 = game.ReplicatedStorage.beame:Clone()
	beam1.Parent = workspace
	beam1.Anchored=false
	beam1.CanCollide=false
	
	if weld == true then
		weld =false
	hpr = plr.HumanoidRootPart
	
	beam1.Massless=true
	
	local Weld = Instance.new("Motor6D")
	
	Weld.Parent=hpr
	
	--Weld.Active=true
	Weld.Part0 = beam1
	
	Weld.Part1=hpr
	
	
--	Weld.C1 = CFrame.new(hpr.Position.X-20,hpr.Position.Y,hpr.Position.Z	)
	--	beam1.Position=Vector3.new(hpr.Position.X,hpr.Position.Y,hpr.Position.Z)
	
	--beam1.Orientation=Vector3.new(90,90,90)	
		beam1.Orientation = Vector3.new(hpr.Orientation.X,hpr.Orientation.Y+90,hpr.Orientation.Z)
		beam1.CFrame = (hpr.CFrame.LookVector)
		wait(10)
		beam1:Destroy()
		weld=true
	end
	wait(10)
	beam1:Destroy()
	--repeat wait() until os.time()-cooldown<10 
	--beam1:Destroy()
	
	
	
	
end)

Thanks in advanced

1 Like

The LookVector of a CFrame is a Vector3. You’re trying to set a CFrame to a Vector3 here, which doesn’t work. You could either remove the LookVector bit or do something else, what are you trying to accomplish?

7 Likes

Any reason you’re welding a part to the character rather than just putting Attachments right on their HumanoidRootPart?

2 Likes

I am trying to make it be at the front of character not in the middle I have absoulutly no idea how to do it

what idk what you mean what ??

What she means is use attatchments to stick the part to the character by creating attatchments from the part to the HumanoidRootPart.

I have no idea how to do that what do I use to connect the 2 attachments together

I was just clarifying what she said that doesn’t mean that’s what you should use. You might want to create another part and put the beam and the part inside a model. Then move the part to the spot where you want the beam to start and set the part to the model’s primarypart. Then use the models primarypart CFrame. In my head that should work let me know if it doesn’t.

1 Like

Okay I will try tommorrow thanks in advanced if it worked

1 Like

Okay, I don’t think I quiet understand what you mean by that?

Should I like weld the 2 parts together? @DaBisawesome123

Yes. Weld the beam and the part, and then weld the beam and the HumanoidRootPart. Then make the CFrame of the models PrimaryPart the CFrame if the HumanoidRootPart.

1 Like

Okay now it tps me to the center of the earth

Ok. This is because you need to put the beam in ServerStorage and :Clone it every time the beam is fired. Otherwise it will just teleport your character to its position in Workspace.

1 Like

OHHHHHHHHHH alright!!! Thanks I will try out now

1 Like

Nope, same thing, it still tps me to the position.

Hmmmm. What does your script look like right now? Also, does the move1 error in output relate to this?

1 Like
weld = true
game.ReplicatedStorage.EVENTS.LightBeam.OnServerEvent:Connect(function(p)
	
	plr = workspace[p.Name]
	
	beam = game.ServerStorage.beame:Clone()
	beam1 = beam.PrimaryPart
	
	beam2 = beam.beame
	beam.Parent = workspace
	--beam1.Parent = workspace
	beam1.Anchored=false
	beam1.CanCollide=false
	beam2.Anchored=false
	beam2.CanCollide=false
	if weld == true then
		weld =false
	hpr = plr.HumanoidRootPart
	
	beam1.Massless=true
		beam1.Massless=true
	local Weld = Instance.new("Motor6D")
	
	Weld.Parent=hpr
	
	--Weld.Active=true
	Weld.Part0 = beam1
	
	Weld.Part1=hpr
		
		
		
		
		
		--local Weld = Instance.new("Motor6D")
		
	--	Weld.Parent=beam1
	--	
		--Weld.Active=true
		--Weld.Part0 = beam2
		
--Weld.Part1=beam1
		
	
--	Weld.C1 = CFrame.new(hpr.Position.X-20,hpr.Position.Y,hpr.Position.Z	)
		--beam1.Position=Vector3.new(hpr.Position.X,hpr.Position.Y,hpr.Position.Z)
	
		beam1.CFrame = CFrame.new(hpr.CFrame.LookVector)
	--beam1.Orientation=Vector3.new(90,90,90)	
		beam1.Orientation = Vector3.new(hpr.Orientation.X,hpr.Orientation.Y+90,hpr.Orientation.Z)
			beam2.CFrame = CFrame.new(beam1.CFrame.LookVector)
		--beam1.Orientation=Vector3.new(90,90,90)	
		beam2.Orientation = Vector3.new(beam1.Orientation.X,beam1.Orientation.Y+90,beam1.Orientation.Z)
		wait(10)
		beam:Destroy()
		weld=true
	end
	wait(10)
	beam:Destroy()
	--repeat wait() until os.time()-cooldown<10 
	--beam1:Destroy()
	
	
	
	
end)

I’ll have to look at this later when I get back to my PC. I’m on my phone rn cause I’m not home. I should be home in less than an hour.

2 Likes

Alrightkk I will try to fix it hope fully lol

Blockquote