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

Roblox wont let my script work it only works if i go disable it then enable it ?

ok so I made this admin script, I think the code is perfect

-- made by vocules

Admins = {"Vocules","Player1","Player2"} -- put the admins here

Prefix = "-" -- Change to your prefix  you want
for i,v in pairs (game.Players:GetPlayers()) do
	v.Chatted:connect(function(msg)
		if msg:lower() == Prefix .. "help" then
			print(Admins[math.random(0,3)])
		end
	end)
end

then I ran into some lame problem I try to press play and then i say -help and then it doesnt print it, but if I go to properties when im playing it disabled and then enable the script everytime i say help it works.. but that is just a pain plus there is no properties in the roblox game.

the script is global and in workspace.

2 comments

0

in other words the script only runs once and that is before the player even loaded

0

You should be the PlayerAdded event.

1 answer

✓ Accepted answer

Use the PlayerAdded Event.

Admins = {"Vocules","Player1","Player2"} -- put the admins here

Prefix = "-" -- Change to your prefix  you want
game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		if msg:lower() == Prefix .. "help" then
			print(Admins[math.random(0,3)])
		end
	end)
end)

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