Cloning beam does not show up?

Im trying to make a beam clone on the client side but it does not show up? I changed the attachemnts position when it is cloned?

script.Parent.MouseButton1Click:Connect(function(plr)
	script.Parent.Parent.Parent.Parent.Tutorial.Visible = true
	local arrow = game.ReplicatedStorage.Arrow:Clone()
	arrow.Parent = workspace
	while true do
		arrow.Attachment1.Position = game.Players.LocalPlayer.Character.HumanoidRootPart.Position
		wait(0.1)
	end
	arrow.Attachment2.Position = game.Workspace.Tutorial.one.Position
end)
1 Like

I think the issue is that since you are in the while true loop, you never reach the line that set the attachment2

1 Like

i tried romoving it and its still does not work

Create an attachment in the part called β€œone”, and try this code instead:

script.Parent.MouseButton1Click:Connect(function(plr)
	script.Parent.Parent.Parent.Parent.Tutorial.Visible = true
	local arrow = game.ReplicatedStorage.Arrow:Clone()
	arrow.Parent = workspace
	arrow.Attachment0 = game.Players.LocalPlayer.Character.HumanoidRootPart.RootAttachment
	arrow.Attachment1 = game.Workspace.Tutorial.one.Attachment
end)

You dont need to update the position of the attachments of the beam in a loop if you set the attachment 0/1 to the right attachments.

it says attachment 0 is not valid member of arrow

is arrow a beam?

charlimitcharlimit

it is a beam


did you spell it correctly as Attachment0, it should be a property of a beam

this mis my code:

everything is spelled correctly

script.Parent.MouseButton1Click:Connect(function(plr)
	script.Parent.Parent.Parent.Parent.Tutorial.Visible = true
	local arrow = game.ReplicatedStorage.Arrow:Clone()
	arrow.Parent = workspace
	arrow.Attachment1 = game.Players.LocalPlayer.Character.HumanoidRootPart.RootAttachment
	arrow.Attachment2 = game.Workspace.Tutorial.one.Attachment
end)

you need to do Attachment0 and Attachment1 instead of Attachment1 and Attachment2

why the names of the attachments are attachments1 and attachments2

The property names of the 2 attachments of a beam are Attachment0 and Attachment1

image

im using this, I think it works the same but I will try it,

image

you dont need to have those two attachments, just try removing them and using the code i gave. If you do use those 2 attachments you would need to update their position in a loop and it would not be as efficient.

thanks for the help, its fixed now!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.