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

Why is this script not functioning? [SOLVED]

This script is uses for Startergear. For example I say "Sword" then it puts it in the starter gear so when you die you will still have.

names = {"GTDRIVER"}	-- Add in the names of the people you want to be able to use the command script here.}

game.Players.PlayerAdded:connect(function(player)
for i, v in pairs(names) do
if v == player.Name then
player.Chatted:connect(function(chatmsg)
if (msg == "Sword") then
game.Lighting["Sword"]:Clone().Parent = Player.StarterGear
end
end)
end
end
end)

1 answer

✓ Accepted answer

You used "chatmsg" for one variable, and "msg" for the other. You also used inconsistent capitalization for the player variable. Make sure they're the same.

names = {"GTDRIVER"}    -- Add in the names of the people you want to be able to use the command script here.}

game.Players.PlayerAdded:connect(function(player)
for i, v in pairs(names) do
if v == player.Name then
player.Chatted:connect(function(msg)
if (msg == "Sword") then
game.Lighting["Sword"]:Clone().Parent = player.StarterGear
end
end)
end
end
end)

2 comments

0

bruh

0

Woops, didn't catch the other mistake at first. Edited.

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