I’m new with chat commands but i wanted to do it to simplify my tests.
I did this script but is not working properly.
local function onPlayerChatted(player, message)
if message == 'removehead' and player.Character and player.Character:FindFirstChild("Head") then
player.Character.Head:Destroy()
end
if message == "\give SwordKit" then
print("message recived")
local path = game.ServerStorage.Katana.SwordKit
for i,v in ipairs(path:GetChildren())do
print('done for the ',i,' time')
local obj = v:Clone()
obj.Parent = player.Backpack
end
end
end
local function onPlayerAdded(player)
player.Chatted:Connect(function (message) onPlayerChatted(player, message) end)
end
game.Players.PlayerAdded:Connect(onPlayerAdded)
I find it strange that if i say removehead it works but if i say \give SwordKit it doesn’t.
No error messages.
What did I do wrong?