I want like to know how to make the text msg giver script I tried to made one which is here:
game.Players.TicTocHat.Chatted:connect(function(msg) if msg == "bb" then game.Lighting:FindFirstChild("Pass/Shoot"):Clone().Parent = game.Players.LocalPlayer.Backpack end end)
but it didn't work and also I would like to know so that everyone can say "bb" and get a tool not just me.
You could use the PlayerAdded
event, and also use the if
coding so that the script doesn't error;
local function Chat(plr,msg) --Heres our Chat function if msg:lower() == "bb" then --If the Player types 'bb then if game:FindFirstChild("Lighting") and game.Lighting:FindFirstChild("Pass/Shoot") and plr and plr:FindFirstChild("Backpack") then --This will check to see if Lighting, Pass/Shoot, The Player, and the Player's Backpack are existant local GiveTool = game.Lighting["Pass/Shoot"]:Clone() --This will clone the object GiveTool.Parent = plr.Backpack --This will Parent the Cloned object into the Player's Backpack end --This ends the code for the second 'if' statement end --This ends the code for the first 'if' statement end --This ends the code for the 'Chat' function game.Players.PlayerAdded:connect(function(plr) --Heres the PlayerAdded event; This will fire everytime a Player joins; The Player whom has joined will be identified as 'plr' plr.Chatted:connect(function(msg) Chat(plr,msg) end) --This connects the Player's Chat to the 'Chat' function end) --This ends the code for the 'PlayerAdded' event
Hope this helped!