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

I am making a Holo and I need help,Can anyone correct me?

So far this is what I have,I already have a Configuration file but I dont know whats wrong

game.Players.ChildAdded:connect(function(player)
player.Chatted:connect(function(chat)
if player:GetRankInGroup(config.GroupId.Value) >= config.RankId.Value then
	if string.lower(chat) == "sf" then
if not game.Workspace:FindFirstChild("Thing") then
game.Lighting.Thing:Clone().Parent = game.Workspace
end
elseif string.lower(chat) == "close sf" then
if game.Workspace:FindFirstChild("Thing") then
game.Workspace.Thing:Remove()
end
end
end
end)
end)


	


1 answer

First off, you should use the PlayerAddedevent instead of ChildAdded. Also, it would be better to check if they're and admin once the join the game, instead of every time they chat.

game.Players.PlayerAdded:connect(function(plr)
	if player:GetRankInGroup(config.GroupId.Value) >= config.RankId.Value then --I assume config is defined somewhere?
		plr.Chatted:connect(function(msg)

Don't forget to rearrange you ends after making these changes!

5 comments

0

You helped a bit but what do you mean check if they are an admin?

0

If they have administrative powers, aka the ability to use the chat commands. " if player:GetRankInGroup(config.GroupId.Value) >= config.RankId.Value then"

0

Checking once as soon as they enter the game will help decease lag instead of checking every time they chat.

0

But I tried it and it didnt work for me

0

Both ways work, but mine is more efficient. If the script does not work it is another problem. Any output?

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