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

Why, wont this help command work?

So I am trying to make a help command for all players, but this part seems not to work.

local BotMessage = game.Workspace.Help_Loader.BotMessage
local mr = math.random(1,3)
local plr = game.Players.LocalPlayer

game.Players.PlayerAdded:connect(function(player)
	player.Chatted:Connect(function(msg)
		if msg == "Bot" or "Bot, I need help" or "Bot, help" then
				if mr == 1 then
				BotMessage.Visible = true
				BotMessage.Text = plr.Name..", how may I help you?"
				wait(2)
				print("Success")
				BotMessage.Visible = false
				BotMessage.Text = "  " 
				
				if mr == 2 then
				BotMessage.Visible = true
				BotMessage.Text = plr.Name..", I am here to assist!"
				wait(2)
				print("Success")
				BotMessage.Visible = false
				BotMessage.Text = "  " 
				
				if mr == 3 then
				BotMessage.Visible = true
				BotMessage.Text = plr.Name..", alright, alright, I am here now!"
				wait(2)
				print("Success")
				BotMessage.Visible = false
				BotMessage.Text = "  " 
				
				end	
				end
			end
		end
	end)
end)

4 comments

0

Is BotMessage a BillBoardGui or SurfaceGui?

0

It's in the script but I want it to be on the screen though, even though I tried a ScreenGUI.

0

So it is a GUI within the script? And you want it to appear to the player who calls for a bot, correct? Is this a Server Script or LocalScript?

0

Regular script, but it is a textLabel unless it is suppose to be a GUi within the script, is it?

3 answers

✓ Accepted answer

In the first line, try changing it to:

local BotMessage = game.Workspace["Help_Loader"].BotMessage

And you set Variable "plr" to the LocalPlayer so make sure you're using a Local Script because it does not work in server scripts.

Instead u could set the "Player" parameter from your PlayerAdded function to the "plr" variable, like this:

game.Players.PlayerAdded:connect(function(Player)
local plr = Player
-- Code --
end)

Where does it go wrong exactly?

1 comment

0

Look below for what I posted and this is what I found

In line 6 it says:

 player.Chatted:Connect(function(msg)

See where the Connect is it is suppose to be connect, BUT it doesn't show an error but it wont work still.

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