Highlight not working properly

  1. What do you want to achieve? Keep it simple and clear!

Create a building effect by tweening a highlight’s FillTransparency on a part on the client.

  1. What is the issue? Include screenshots / videos if possible!

It works in studio but not on roblox client. I tried to replicate this on a separate place (you can check the code there if you want. Touch the flying part to start the effect.) but without success because everything there works correctly. (And yes, it is published I checked that multiple times…)
Game link


--Cylinders == Folder; (game.Players.LocalPlayer.Name) == Folder;
workspace.Cylinders:WaitForChild(game.Players.LocalPlayer.Name).ChildAdded:Connect(function(child)
		local highlight = script.Highlight:Clone()
		highlight.Parent = child
		local tween = tweenService:Create(highlight,TweenInfo.new(0.5,Enum.EasingStyle.Exponential,Enum.EasingDirection.Out,0,false,0),{FillTransparency = 1})
		tween:Play()
		tween.Completed:Once(function()
			tween:Destroy()
			highlight:Destroy()			
		end)
		--More code doing something else
	end)

image

This is a part of a localscript parented to StarterGui. Reset character is disabled and it is impossible to die or reset this script in any way.
The server spawns the parts into this folder.
There are no other highlights in the game.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I did some research but couldn’t find anything related to this.

Is this a bug or am I missing something?
Thank you for your help!

Set the Adornee.

local highlight = ...
highlight.Adornee = child
highlight.Parent = child

Still doesn’t work… You can check it in game

Did you set it and make sure to publish the game?

Yes I did, why are you even asking this…


obrazek

Maybe because of the graphics settings? Max your graphics in roblox.

It is maxed as well as in studio. character limit

I doubt this is the fix as it is literally not inside studio, but in roblox:

Instead of cloning a highlight delete all the highlights you got right now and just use Instance.new() to create a new highlight and just destroy it afterwards.

You’re doing tween:Destroy() which is unnecessary and If you want to stop a tween you would have to use Cancel()

Most likely your code is erroring out because of that, and Highlight is never destroyed, and you reach the 31 limit which causes the highlights not to work properly.

workspace.Cylinders:WaitForChild(game.Players.LocalPlayer.Name).ChildAdded:Connect(function(child)
		local highlight = script.Highlight:Clone()
		highlight.Parent = child
		local tween = tweenService:Create(highlight,TweenInfo.new(0.5,Enum.EasingStyle.Exponential,Enum.EasingDirection.Out,0,false,0),{FillTransparency = 1})
		tween:Play()
		tween.Completed:Once(function()
			--tween:Destroy() (culprit)
			highlight:Destroy()			
		end)
		--More code doing something else
	end)

Then why would the same code work on a different place with basicly the same setup?

local h = script:WaitForChild("Highlight")
local t = workspace:WaitForChild("Folder"):WaitForChild("Folder")
t.ChildAdded:Connect(function(child)
	local c = h:Clone()
	c.Parent = child

	local tws = game:GetService("TweenService")
	local tw = tws:Create(c,TweenInfo.new(3,Enum.EasingStyle.Exponential,Enum.EasingDirection.Out,0,false,0),{FillTransparency = 1})
	tw:Play()
	tw.Completed:Once(function()
		tw:Destroy()
		c:Destroy()			
	end)
end)

+ It works without any errors

I am sorry, but it still doesn’t work. I have no idea why.
obrazek

local highlight = Instance.new("Highlight") --script.Highlight:Clone()
		highlight.FillColor = Color3.new(1,1,1)
		highlight.OutlineTransparency = 1
		highlight.Adornee = child
		highlight.Parent = child
		local tween = tweenService:Create(highlight,TweenInfo.new(0.5,Enum.EasingStyle.Exponential,Enum.EasingDirection.Out,0,false,0),{FillTransparency = 1})
		tween:Play()
		tween.Completed:Once(function()
			tween:Destroy()
			highlight:Destroy()			
		end)

Oh wait my bad, you can call :Destroy() on tween although I am not sure why… cause it doesn’t do anything. If you want to cancel a tween though you can do :Cancel(). As for the highlights not showing you are most likely running into the limit some way after all your tween seems to last 3 seconds and multiple highlights show up fairly quickly. It might mean a bunch of highlights spawn and then get removed.

Also, I just noticed you have this line of code, is this just one highlight or multiple.

local highlight = script.Highlight:Clone()
highlight.Parent = child

As seen in the video, it spawns the highlight for each part individually. So yes it is for multiple parts. Each with a delay.

Edit:
It can’t/shouldn’t be the highlight limit, it doesn’t work even with 3 parts.

Is the script.Highlight:Clone() just 1 single highlight? Or are there multiple scripts with multiple highlights for each cylinder that spawns. Cause do keep in mind that 31 limit is really easy to hit for each instance that exists anywhere it adds to that limit.

It is only this one script that does and script.Highlight:Clone() is just single highlight

And I am not sure but doesn’t the limit apply only for studio client?


It works in studio but not on roblox client

This applies to both, with the only exception of the new studio tools that utilizes highlights.

Oh ok.
Btw here are some stats:


once a new highlight gets created or destroyed print amount of highlights.
So I am not near the limit.

The worst part is that I can’t reproduce this on a different place so I don’t know if it is a roblox’s bug or my mistake…

I am not sure then, if your highlights are being created and destroyed properly (without any errors) then there should not be any issues. It’s most likely some sort of bug.