I have 2 localscripts. the first one checks if there are 2 or more players. if there are, it stops the script. if there are less than 2 or more players, it continues the script. the script waits 10 seconds, then has the text fade in. here is the script.

if game.Players.NumPlayers >= 2 then
	wait()
end

if game.Players.NumPlayers <= 1 then

wait(10)

for i=1,10 do
    script.Parent.TextTransparency = script.Parent.TextTransparency-0.1
    wait(0.01)
end

end

my second localscript checks if there are 2 or more players. if there are, it continues the script, if there are less than 2 or more players (1 player) then it stops. when it continues the script, it makes it so that the text does not fade in at all for the 2nd player, and SHOULD fade out the text on the first player. however, the text does not fade out at all.

if game.Players.NumPlayers <= 1 then
	wait()
end

if game.Players.NumPlayers >= 2 then
	
	if script.Parent.TextTransparency == 1 then
		wait()
	end
	
	if script.Parent.TextTransparency == 0 then

for i=1,10 do
            script.Parent.TextTransparency = script.Parent.TextTransparency+0.1
            wait(0.01)

	end
	end
	end

what am i doing wrong?

4 comments

0

NumPlayers is deprecated, use #game.Players:GetPlayers() instead

0

As previously stated, "NumPlayers is deprecated, use #game.Players:GetPlayers() instead". Tutorials of this can be found at the following: https://developer.roblox.com/api-reference/function/Players/GetPlayers - I would then suggest using Remote Events to connect the Server and the Clients together to perform the action of changing the GUIs transparency and so forth.

0

Remote Functions and Events can be found here: https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events - If either of these comments helped in anyway shape or form. Don't forget to give am up-vote. :)

0

You asked the same question yesterday in which I have already provided you with a working solution.