I'm trying to make it so that when I click on the basicGrave it creates a new attachment with Part1 as the parent and updates my Beam in game.StarterPack.starterTool.Handle's attachment0. The script I have below creates the attachment, assigns its location/parent, and updates the Beam but produces no beam effect. If I do this manually without the script then it works just fine.


script.Parent:WaitForChild("ClickDetector").MouseClick:Connect(function(plr)
	if script.Parent.Name == "basicGrave" then
		if plr:FindFirstChild("leaderstats") then
			local vacuumBeam = Instance.new("Attachment")
			vacuumBeam.Parent = script.Parent.Part1
			vacuumBeam.Position = Vector3.new(vacuumBeam.Parent.Position.X,vacuumBeam.Parent.Position.Y,vacuumBeam.Parent.Position.Z)
			game.StarterPack.starterTool.Handle.Beam.Attachment0 = vacuumBeam
		end
	end
end)

2 comments

0

You know, instead of using .X, .Y, and .Z you can just put Vector3.new(vacuumBeam.Parent.Position) ?

0

When I do that the location of the created attachment becomes 0,0,0