What is the general idea between making a line between two parts, similar to games where a player has to go to a certain location and they have a line leading them to the destination ?
Is this an actual roblox service or are you using an AI to generate your content? If we want AI solutions, weāll ask an AI ourselves.
Please stop using AI. Make posts with your own knowledge please. As @Vectue already proved, you used information of AI. People are already aware, you canāt become famous using AI.
Drawing.new() isnāt a service, itās just our own constructor (basically think like itās our own Vector3.new()), but this guy has just copy-paste the information, so you got confused.
Is there any sort of external module that needs to be downloaded?
Oh.
Nope, if you have experience with scripting and ModuleScripts, we can make our own constructors there and use it in normal scripts.
For clarity, letās say we want to find area of a rectangular part, weāll make module like this
local rectangle = {}
function rectangle.Area(length, breadth)
print(length * breath)
end
return rectangle
Now use it in normal scripts like this
local Rectangle = require(game.ReplicatedStorage.Module)
Rectangle.Area(20, 30)
It should print 600
As you saw, we made our own constructor Rectangle.Area()
I think the AI he used was taking data from a Synapse X post on the internet, because thatās also the only thing I found after a quick search about paths
Nonetheless people using AI to try and give solutions is a bit of a problem
Correct, even today I didnāt used AI, but people thought I used AI because of nowadays, itās a trend, so people thinks us suspicious.
Ok, so do you mean like an arrow pointing indicating towards a part ?
No i was looking for a line to be drawn between two parts, iāve got a beam for now but Iām trying to get a line that is flat not like a trail
Okay, Iām sorry, Iām really embarrassed.
If you want an animated line, a beam is the way to go. But I think you want a part so instead you should:
1- get the position of both parts
2- add the two positions then divide them by 2 to get the centre position
3- subtract the 2 points then use their .Magnitude property to determine the length of the part
4- use CFrame.lookAt from the centre point, and look at one of the points, doesnāt matter which one
local p1 = workspace.p1 -- first part
local p2 = workspace.p2 -- second part
local part = Instance.new('Part')
part.Anchored = true
part.Parent = workspace
local function updatePart()
local startPoint, endPoint = p1.Position, p2.Position
local centre = (startPoint + endPoint) / 2 -- this is basically the "average" position given the 2 points
local length = (startPoint - endPoint).Magnitude
part.Size = Vector3.new(0.1, 0.1, length) -- X is width, Y is height and Z is length
part.CFrame = CFrame.lookAt(centre, startPoint)
end
game:GetService('RunService').Heartbeat:Connect(updatePart)
hey dude, itās fine if you use ChatGPT and the like to help you with code. However, notice my wording. āHelp.ā You wonāt get better at scripting if you donāt try to understand it without some effort. Try using youtube tutorials for a general problem or skill, only use chatGPT if youāre really, really stumped. If not, then at least check it; it wonāt be optimized and chatGPT might miss some things, so itās worth it to look for potential errors.
Yes bro, i really need help with the script in my place.
just use that guyās script, i can explain it but if you need it for any specific reason without a pre-labelled part; just change the p1 or p2
pathfinding service might help you.
or just make a beam and 2 attachments at part 1 and part 2 and give it arrow texture ĀÆ_(ć)_/ĀÆ