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.
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
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.
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!
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.
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)
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
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.
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.