Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I resize my laser beam so that it goes one way relative to where my mouse is pointing at?

Here is my script:

local db = true

game.ReplicatedStorage.Events.LaserAttack.OnServerEvent:Connect(function(player, mouse)
	if db == true then
		db = false
		local sizeIncrease = Vector3.new(2, 0, 0)
		local laser = game.ReplicatedStorage.Laser:Clone()
		local rotatedCFrame = CFrame.Angles(0, math.rad(90), 0)
		laser.CFrame = CFrame.new(player.Character.HumanoidRootPart.Position, mouse)
		laser.CFrame = laser.CFrame:ToWorldSpace(rotatedCFrame)
		laser.Parent = game.Workspace.Lasers

		for i = 1, 100 do
			laser.Size = laser.Size + sizeIncrease
			wait()
		end

		wait(3)
		db = true
	end
end)

When I tested it, the result is my part going both ways, how do I fix that?

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.