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

Why is this script not functioning? [SOLVED]

Asked by 10 years ago

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

Log in to vote
2
Answered by
2eggnog 981 Moderation Voter
10 years ago

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)
0
bruh Hybric 271 — 10y
0
Woops, didn't catch the other mistake at first. Edited. 2eggnog 981 — 10y
Ad

Answer this question