I added a ‘highlight’ to a rig model , everything is fine except there’s a part welded inside, it’s a tool attached to the rig, a gun. However, I don’t want it to have an outline. I only want the rig of the model, but if I remove the gun from the model, it won’t move with it. Additionally, if I outline every part of the model except the gun, it creates an incorrect outline and glitches in the hairof the rig . How can I solve this problem?
Could you send a screen shot? I’m not sure if it’s possible to solve this, besides through moving the handle of the tool outside of the rig’s Model.
You could heart this feature request, which would solve your problem:
I don’t think there’s a good solution for that.
You could make the tool’s original parts invisible (to keep the functionality) then create duplicate parts outside of the character that are welded to the handle.
Yes, that’s my issue, and I can’t move the tool out because the rig is an NPC, so when he moves in the game, the tool won’t come out with him.
You could make the tool’s original parts invisible (to keep the functionality) then create duplicate parts outside of the character that are welded to the handle.
What do you mean by that?
and yes it would be great to have a feature like that
Highlight:RemoveTarget(target: PVInstance) -> ()
Basically something like this:
local function highlightChar(character)
local highlight = Instance.new("Highlight")
-- TODO: Add your highlight settings
highlight.Parent = character
-- Now hide the real parts and create dummy visual-only parts
local tool = character:FindFirstChildOfClass("Tool")
local endHighlightFunction = function() end -- A blank function, does nothing
if not tool then return endFunction end
local partVisiblities = {}
local stuffToDelete = {}
table.insert(highlight, stuffToDelete)
for _, instance in ipairs(tool:GetDescendants()) do
if not instance:IsA("BasePart") return end
local toolPart = instance
-- Save the og transparency so we can reset it, and make it invis
partVisiblities[toolPart] = toolPart.Transparency
toolPart.Transparency = 1
-- Make our only-for-visuals dummy part
local dummyPart = toolPart:Clone()
-- Make the dummy part visuals only (so it doesn't interfere with anything)
dummyPart.CanCollide = false
dummyPart.CanTouch = false
dummyPart.CanQuery = false
dummyPart.Massless = true
-- TODO: Create a weld between dummyPart and toolPart (and parent the weld to dummyPart so it's removed)
-- The visual parts aren't in the character, so they don't get highlighted with the character
dummyPart.Parent = workspace
-- Store the dummy part so we can remove it later
table.insert(dummyParts, stuffToDelete)
end
endHighlightFunction = function()
-- Reset the transparencies of the tool's parts
for transparency, part in pairs(partVisiblities) do
part.Transparency = transparency
end
-- Destroy the dummy clone parts that are just for visuals
for _, instance in ipairs(stuffToDelete) do
instance:Destroy()
end
end
return endHightlightFunction
end
Example usage:
local character = -- Some character
-- Start the highlight:
local stopHighlight = highlightChar(character)
task.wait(5)
-- Stop the highlight after 5 seconds
stopHighlight()
The code makes the tool invisible, so it’s not highlighted, then adds “dummy” duplicate parts that are visuals only (no touching, raycasting, physics, etc) outside of the character. The dummy parts are outside of the character, so they aren’t hightlighted, but they look exactly like the tool. Using welds, the dummy parts can also be in the exact same position as the real parts.
This isn’t an ideal solution. This might be able to be used on the server, but ideally it would be used on the client. It doesn’t work well with tools that have parts that change transparencies (you’d need to add some connections for that).
That’s a good solution, thank you.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.