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

Quick Help on a Chatted Random Event?

I am a fairly good scripter but stumbling apon this script that does not seem do execute/work.

ran = math.random(1,100)
game.Players.DhatBoiiPapi:Chatted(function(msg)
	local hint=Instance.new("Hint")
if msg=="/Random/Numbers" then
	hint.Parent=game.Workspace
	hint.Text="Random Number chosen is :"..ran.." !"
	wait(5)
	hint.Parent=nil
	
end	
end)

Help would be acknowledged

2 answers

The only thing I notice is that the 'random number' will be the same every time since you put it at the beggining of the script, if you put it after line 2 then you would get a new number every time. Also I would put instead of making the hint's parent nill I would do: hint:Destroy().

5 comments

0

Okay, I will just do hint:Clone(). Thank you, I will see if this helped.

0

I don't think that will make it any different, but tell me if it does work like that. :)

0

If it doesn't work, move line 1 to line 3 moving the current line 3 and everything under it down one line.

0

I tried that. It still doesn't work. I think its a problem with the Chatted Event.

0

bump.?

Repaired Version

ran = math.random(1,100)
game.Players["DhatBoiiPapi"]:Chatted(function(msg)
	if msg:lower()=="randomnumbers" then
		local hint=Instance.new("Hint")
		ran = math.random(1,100)
		hint.Parent=Workspace
		hint.Text="Random Number chosen is :"..ran.." !"
		wait(5)
		hint.Parent=nil
	end 
end)

2 comments

0

Once agian. Got downvoted for a working version.

0

I am trying yours. Doesn't seem to work either.

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