How can I make a beam that comes from the player's hand?
Pretty much it, I can't seem to figure out how to make a beam come from the players hand
How can I make a beam that comes from the player's hand?
Pretty much it, I can't seem to figure out how to make a beam come from the players hand
I’m entirely clueless if this code will perform the action you desire, as I did my best to visualize the scenario and tried to apply some snippets from trajectory calculations with integrated Raycast data—from a firearm.
local Debris = game:GetService("Debris")
local Player = game:GetService("Players").LocalPlayer
local Cursor = Player:GetMouse()
local function DrawBeam(StartPos, EndPos)
local Beam = Instance.new("Part")
Beam.Name = "Beam"
Beam.Material = Enum.Material.Neon
Beam.CanCollide, Beam.Anchored = false, true
Beam.BrickColor = BrickColor.Red()
Beam.Size = Vector3.new(.3,.3,EndPos)
Beam.CFrame = CFrame.new(StartPos, EndPos) * Cframe.new(0,0,-EndPos/2)
return Beam
end
Cursor.Button1Down:Connect(function()
local Character = Player.Character or Player.CharacterAdded:Wait()
local RightHand = Character:WaitForChild("RightArm")
local ToClickPosition = (RightHand.Position - Cursor.Hit.p).magnitude
local Beam = DrawBram(RightHand.Position, ToClickPosition)
Beam.Parent = workspace
Debris:AddItem(Beam, 1)
end)
Thank you, this gave me a pretty good example on how to do it. and I managed to figure it how.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Learn about tools
Without tools :/