I’m currently making a Guided Missile and I can’t seem to find any posts related to this. What I’m trying to make is a Vehicle Marker.
So basically if you are on a radar seat you can see Vehicle Markers like this:
I am still struggling to find a script like this. I have tried making a script that detects a part with a specific name will make a gui frame follow it but it still doesn’t work.
it doesn’t seem intuitive to have an ImageLabel “follow” a part. Instead, instancing a BillboardGui into the desired part on command is probably what you should opt for.
local targetPart = workspace.Target -- Reference your part here
local billboardGui = Instance.new("BillboardGui") -- Customize the BillboardGui below, don't forget to add the ImageLabel
local function acquireTarget()
billboardGui.Parent = targetPart
end
local function leaveTarget()
billboardGui.Parent = game:GetService("ReplicatedStorage") -- You can store it anywhere you'd like
end
-- Fire acquireTarget() if the player is seated and leaveTarget() if unseated
Assuming you have the parts you want to detect stored in a folder called “Targets”:
local targetParts = workspace.Targets -- Reference your folder here
local billboardGui = Instance.new("BillboardGui") -- Customize the BillboardGui below, don't forget to add the ImageLabel
local function acquireTarget()
for _, target in ipairs(targetsParts:GetChildren()) do
local billboardGuiCopy = billboardGui:Clone() -- copies the BillboardGui each time the function is called
billboardGuiCopy.Parent = target
end
end
local function leaveTarget()
for _, target in ipairs(targetsParts:GetChildren()) do
target.NameOfTheBillboardGui:Destroy() -- removes the copies again
end
end
-- Fire acquireTarget() if the player is seated and leaveTarget() if unseated
Alternatively you can scan Workspace for parts with a specific name:
local targetName = "target" -- Set the name of the targets
local billboardGui = Instance.new("BillboardGui") -- Customize the BillboardGui below, don't forget to add the ImageLabel
local function acquireTarget()
for _, content in ipairs(game:GetService("Workspace"):GetDescendants()) do
if content:IsA("BasePart") and content.name == targetName then -- assuming the target is a part
local billboardGuiCopy = billboardGui:Clone()
billboardGuiCopy.Parent = content
end
end
end
local function leaveTarget()
for _, content in ipairs(game:GetService("Workspace"):GetDescendants()) do
if content:IsA("BasePart") and content.name == targetName then
content.BillboardGuiName:Destroy()
end
end
end
-- Fire acquireTarget() if the player is seated and leaveTarget() if unseated
How am I supposed to get all of the target billboards if they are all inside a model. Unless there is a script that finds a part name with descendant from workspace.