local ProximityPrompt = script.Parent.ProximityPrompt
ProximityPrompt.Triggered:Connect(function(Player)
if Player.Backpack:FindFirstChild("Cola") =~ nil then
local copy = game.ReplicatedStorage["Cola"]:Clone()
copy.Parent = Player.Backpack
end)
I think this will work, I basically added if Cola isn’t found in the player’s backpack, then put it in their backpack.
The problem is actually that you guys have forgotten to close the if statement! All you need to do is add an “end” before the “end)” on the last line:
local ProximityPrompt = script.Parent.ProximityPrompt
ProximityPrompt.Triggered:Connect(function(Player)
if Player.Backpack:FindFirstChild("Cola") =~ nil then
local copy = game.ReplicatedStorage["Cola"]:Clone()
copy.Parent = Player.Backpack
end
end)
local ProximityPrompt = script.Parent.ProximityPrompt
ProximityPrompt.Triggered:Connect(function(Player)
if Player.Backpack:FindFirstChild("Cola") ~= nil then
local copy = game.ReplicatedStorage["Cola"]:Clone()
copy.Parent = Player.Backpack
end
end)
ProximityPrompt.Triggered:Connect(function(Player)
if Player.Backpack:FindFirstChild("Cola") == nil then
local copy = game.ReplicatedStorage["Cola"]:Clone()
copy.Parent = Player.Backpack
end
end)