Hello ! I’m currently working on an FPS System, and i came to the bullet part. I wanted to make a bullet that would be a simple yellow line because i don’t want something complictaed that i will not understand. I have to use “LineHandleAdronement” but i don’t know how i can ?
Here is the serverscript (that handles raycasting) :
local RS = game:GetService("ReplicatedStorage");
local Events = RS:WaitForChild("Events")
Events.Fire.OnServerEvent:Connect(function(plr, part, pos, damage, o, op, ocf)
if part.Parent:FindFirstChild("Humanoid") then
local humanoid = part.Parent.Humanoid;
if humanoid.Health > 0 then
humanoid:TakeDamage(damage);
end
else
local impact = RS:WaitForChild("Objects").Impact:Clone();
impact.Position = pos
impact.Parent = workspace
game.Debris:AddItem(impact, 5);
end
end)
See: LineHandleAdornment. I think the documentation is sufficient enough to understand what’s going on here. You parent a LineHandleAdornment to a BasePart representing the bullet and extend the length of the line accordingly.
Assuming you’re using LineHandleAdornments to visualise raycasts then probably all you’d need is to calculate the magnitude between the origin and the hit position to find out the length.
They also do have an Adornee, so make sure to set that. I can’t really help you any further if you’re still encountering issues with bullet visualisation unless you show me the exact code you’re currently using to manage the LineHandleAdornment as well as any related errors, if any.
Both Adornee and Parent (set Parent last rather than right after making it for a little performance boost) should be the bullet part or some place where the adornment can reside in.