Module script functions not working

It didn’t worked.

BUT, you right I putted a duration thing in the Configuration module that make it wait.

for i=1, 20 do
	workspace["Huan Ying"].Volume -= 0.05
	wait(0.06)
end

Guess I should put coroutine thing ?

task.spawn(function()
	for i=1, 20 do
		workspace["Huan Ying"].Volume -= 0.05
		wait(0.06)
	end
end)

Thanks for the help @Crygen54 and @BritainGroup_Holder ! And everyone too.

1 Like

Hmm, I think I would try another solution.

The script:

Players.PlayerAdded:Connect(function(player)
local CreateLeaderstats = require(CreateLeaderstats.OnJoin(player)
end)

1 Like

Yeah you got it !

Code in modules are same as if the code was in your script in where you’re requiring and running modules functions, so when there is a loop or wait time, the script do not continue until it is finished.

And yeah, using task.spawn should be fine for it… you can also use a tween instead of repeat until, it does the same and do not make your code stuck

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.