I have a simple highlight script inside StarterPlayerScripts that checks for things tagged with Highlightable Tag however when i add the tag to a model, the script doesn’t register it as tagged, does anyone know how i can make it able to hightlight models as well ?
local CollectionService = game:GetService("CollectionService")
CollectionService:GetInstanceAddedSignal("Highlightable"):Connect(function(part)
local Outline = part:FindFirstChild("Outline")
warn(part)
part.ClickDetector.MouseHoverEnter:Connect(function()
if Outline then
Outline.Enabled = true
end
end)
part.ClickDetector.MouseHoverLeave:Connect(function()
if Outline then
Outline.Enabled = false
end
end)
end)
Are you assigning/removing any other tags to the model from the server? Tags added on the client are overwritten when a model gets assigned or is removed of a different tag by the server.
‘When tags replicate, all tags on an object replicate at the same time. Therefore, if you set a tag on an object from the client then add/remove a different tag on the same object from the server, the client’s local tags on the object are overwritten.’
i somehow did this and now it only highlights models XD
local CollectionService = game:GetService("CollectionService")
local Highlighables = CollectionService:GetTagged("Highlightable")
warn(Highlighables)
for i,v in Highlighables do
local Outline = v:FindFirstChild("Outline")
v.ClickDetector.MouseHoverEnter:Connect(function()
if Outline then
Outline.Enabled = true
end
end)
v.ClickDetector.MouseHoverLeave:Connect(function()
if Outline then
Outline.Enabled = false
end
end)
end
AHAHAHHAHAHAH, guess what , i combined both scripts and it does what i want !
-----------------------------------------------------------------------------------------
local CollectionService = game:GetService("CollectionService")
CollectionService:GetInstanceAddedSignal("Highlightable"):Connect(function(part)
local Outline = part:FindFirstChild("Outline")
part.ClickDetector.MouseHoverEnter:Connect(function()
if Outline then
Outline.Enabled = true
end
end)
part.ClickDetector.MouseHoverLeave:Connect(function()
if Outline then
Outline.Enabled = false
end
end)
end)
-----------------------------------------------------------------------------------------
local Highlighables = CollectionService:GetTagged("Highlightable")
for i,v in Highlighables do
local Outline = v:FindFirstChild("Outline")
v.ClickDetector.MouseHoverEnter:Connect(function()
if Outline then
Outline.Enabled = true
end
end)
v.ClickDetector.MouseHoverLeave:Connect(function()
if Outline then
Outline.Enabled = false
end
end)
end
-----------------------------------------------------------------------------------------