I'm not the best scripter, but I want to know how I can make it so when a player clicks it once they get the tool ( That part's done ) But when they click it again it doesn't give it to them because it's in their inventory. I've been thinking about how to approach this but it's kinda difficult.
local CupGiver = script.Parent local Detector = CupGiver.ClickDetector local Players = game.Players.LocalPlayer Detector.MouseClick:Connect(function(Player) local Cup = game.ReplicatedStorage.Cup:Clone() Cup.Parent = Player.Backpack print(Player) if Cup.Parent == Player.Backpack then end end)
Not sure what to do with the if Cup.Parent thing so the Script knows the character can only have one.
Detector.MouseClick:Connect(function(Player) local Character = Player.Character or Player.CharacterAdded:Wait() if not Player:WaitForChild("StarterGear"):FindFirstChild("Cup") then local newCup = game.ReplicatedStorage.Cup:Clone() newCup.Parent = Player:WaitForChild("StarterGear") newCup:Clone().Parent = Character else print("Player already has the tool 'Cup' in their inventory.") end end)