How to make a Luck based npc dialogue?

Okay so this is a dialogue messages and answer stuff for a character named jenna

say hi to jenna

I am trying to make it luck based
like
player clicks a button %60 chance it will skip the waiting (normally around 3 seconds for a message) and will print out the whole message
and for the %40 chance it won’t do anything

But I am kinnda confused about how to make it luck based
like player Clicks to skip button and it won’t wait or will have to wait until it print’s out fully

local Jenna = game:GetService("Workspace"):WaitForChild("Jenna")
local Messages = {"Wakamole"
,"Ortengo?"
,"MankilKong."}

local Answer1 = {"Manifesto",
"Scoobydoo Was definetly good cartoon."
	,"Justieveit."
}


Jenna.ClickDetector.MouseClick:Connect(function()
	local TextGui = script.Parent
	TextGui.Enabled = true
	for i,v in pairs(Messages) do
		for i=1 , string.len(v) do task.wait(0.25)
		TextGui:WaitForChild("TextHolder"):WaitForChild("TextLabel").Text = string.sub(v,1,i)	
		end
	end
end) 
1 Like

You could try to include just a basic math.random() whenever a player clicks the Skip button, by storing some debounces if player already did it, and if its allowed to reply

TextGui:WaitForChild("SkipBTN").Activated:Connect(function()
	if not skipDice and not replyAllowed then
		if math.random(0,100) < 50 then
			TyperWait = 0
			warn("got lucky")
		else
			warn("bad luck you cant skip this time")
			skipDice = true
		end
	else
		warn("you already tried your luck")
	end
end)
2 Likes

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