Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I'm working on my chat commands, but it can't seem to work. Help?

Asked by
Aqu_ia 39
4 years ago

Okay, so here is my script:

local SSS = game:GetService('ServerScriptService'); 
local player = game:GetService("Players");

player.PlayerAdded:Connect(function(plr)
    plr.chatted:connect(function(msg)
        if msg:lower() == '/ranktagoff' then
         game.Workspace[plr.Name].Head.RankTags:Destroy()
        end
    end)
end)

player.PlayerAdded:Connect(function(plr)
    plr.chatted:connect(function(msg)
        if msg:lower() == '/ranktagon' then
         game.ServerScriptService.TimelessScriptsRewrite.RankTagSystem:FindFirstChild("RankTags"):Clone().Parent = game.Workspace[plr.Name].Head
        end
    end)
end)

The error is:

game.ServerScriptService.TimelessScriptsRewrite.RankTagSystem
:FindFirstChild("RankTags"):Clone().Parent = game.Workspace[plr.Name].Head

Whenever I try to run it, the error message says:

ServerScriptService.AquaScripts.RankTagOnOff:15: attempt to index a nil value 15:55:39.895 - Stack Begin.

Please help me fix this. Thank you very much!

0
TimelessScriptsRewrite is not a valid member of ServerScriptService, just like the error implies. pidgey 548 — 4y
0
Also, why do you have two separate chatted and playeradded events, when you only need one of each theking48989987 2147 — 4y
0
Also, why do you have two separate chatted and playeradded events, when you only need one of each theking48989987 2147 — 4y
0
do plr.Character.Head Warfaresh0t 414 — 4y

Answer this question