I'm trying to make a giver that will give you coffee if you type "coffee" or "Coffee" into the textbox and hit enter, but the script just isn't working. I took the script out of a custom giver and changed a few things, could someone please help?
I am a noob with scripting, so please go easy on me!
01 | --[[----------------]] -- |
02 | local A = script.Parent.TextBox |
03 | --[[----------------]] -- |
04 | if |
05 | A.text = = "Coffee" |
06 | or |
07 | A.text = = 'coffee' |
08 | then |
09 |
10 | local allow_duplicates = true |
11 | local allow_team = { |
12 |
13 | } |
14 | --[[----------------]] -- |
15 | local button = script.Parent |
local ss = game.ServerStorage -- make sure to put the coffee tool in serverstorage and name it "coffee" or "Coffee" but then you need to edit the script. player = game.Players.LocalPlayer
function onChatted(msg)
if string.find(string.lower(msg), string.lower("coffee")) and string.find(string.lower(msg), string.lower("")) then
1 | if not player.Backpack:FindFirstChild( "coffee" ) then |
local coffee = ss:FindFirstChild("coffee"):Clone() coffee.Parent = player.Backpack end end end
game.Players.PlayerAdded:connect(function(OnChatted)
1 | end |
end) -- I personally didn't test it but it should work.