Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make Sequential-Transparency-Change work better?

Hello!

So I have a script that needs to make 4 parts in the same model change their transparency in an order. The script does this but sometimes it a part doesn't change its transparency at all, sometimes it happens fast and smooth, sometimes it happens slow and rough. Can someone help me make it work better?

Script:

local CapeSpeed = 0.2
local NotUsed = script.Parent:WaitForChild("Chest1"):FindFirstChild("NotUsed")
local Use1 = script.Parent:WaitForChild("Chest1"):FindFirstChild("Use1")
local Use2 = script.Parent:WaitForChild("Chest1"):FindFirstChild("Use2")
local Used = script.Parent:WaitForChild("Chest1"):FindFirstChild("Used")

function CapeBegin()
	NotUsed.Transparency = 1
	Use1.Transparency = 0
	wait(CapeSpeed)
	Use1.Transparency = 1
	Use2.Transparency = 0
	wait(CapeSpeed)
	Use2.Transparency = 1
	Used.Transparency = 0
end

function CapeEnd()
	Used.Transparency = 1
	Use2.Transparency = 0
	wait(CapeSpeed)
	Use2.Transparency = 1
	Use1.Transparency = 0
	wait(CapeSpeed)
	Use1.Transparency = 1
	NotUsed.Transparency = 0
end

while true do
	wait(1)
	CapeBegin()
	wait(1)
	CapeEnd()
end

1 answer

How well that script runs will solely depend on the servers task scheduler load at the time. If its a big game, it may take a bit longer. From what you have wrote, there are no errors in your code and changing your method of coding it wouldent provide any visible change. Thus your question isnt really answerable. If it is running slow, you can try reducing the amount of loops in your game or making the wait() values longer. I hope I was able to help. ~mc3334

This discussion is preserved as it was. New answers, comments, and votes are closed.