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

Script doesn't run function even though it's called?

function newSkin()
	if(math.random(1) > 0.5) then
		print("bigger")
	else
		print("smaller")
	end
end

if(player:WaitForDataReady()) then
	wait(script.Parent.Visible == true)
	x = 0
	while(x < 500000) do
		script.Parent.MouseButton1Click:connect(function()
			newSkin()
		end)
		x = x + 1
		wait(0.03)
	end
	player:Destroy()
end


Why doesn't it even load "newSkin()"? You can see the game here. I'm baffled

1 answer

First off, you don't need to connect the function to the event half a million times. Second, try changing line 2 to this: if (math.random(1,2)>1) then Finally, try taking out the WaitForDataReady(). The final script should look like this:

function newSkin()
	if math.random(1,2)>1 then
		print("bigger")
	else
		print("smaller")
	end
end
script.Parent.MouseButton1Click:connect(newSkin)

That should fix the newSkin() issue. Hope this helped!

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