Please help me>>
Noobish scripter here
This is simple. First, you start with the click function;
script.Parent.MouseButton1Click:connect(function() end)
then you should check if the player already has the item.
if not game.Players.LocalPlayer.Backpack:FindFirstChild("Sword") then end
and then give the player the item.
print("Giving "..game.Players.LocalPlayer.Name.." a sword.") Sword = game.ReplicatedStorage.Sword:Clone() --Clone the sword, change this to wherever your sword is. Sword.Parent = game.Players.LocalPlayer.Backpack --Parenting the newly cloned item
and if they already have it
elseif game.Players.LocalPlayer:FindFirstChild("Sword") then print(game.Players.LocalPlayer.Name.." Already received the sword.")
so it should look like this in the end;
--Put this in the image button --This must be a local script. script.Parent.MouseButton1Click:connect(function() --Clicked if not game.Players.LocalPlayer.Backpack:FindFirstChild("Sword") then --If they dont already have the sword print("Giving "..game.Players.LocalPlayer.Name.." a sword.") Sword = game.ReplicatedStorage.Sword:Clone() --Clone the sword, change this to wherever your sword is. Sword.Parent = game.Players.LocalPlayer.Backpack --Parenting the newly cloned item elseif game.Players.LocalPlayer:FindFirstChild("Sword") then print(game.Players.LocalPlayer.Name.." Already received the sword.") end end)