I made an inventory GUI and each time u left click a certain text button a pet appears and follows you.Now i want that pet deleted when player right clicks the same text button how do i do that? I have already tried something but it didn't work,here is the whole script(the upper part works)
local target = game.ReplicatedStorage.AlphaPet
script.Parent.MouseButton1Click:connect(function()
if game.Players.LocalPlayer.Character:FindFirstChild("AlphaPet")== nil then
local pet = target:Clone()
pet.Parent = game.Players.LocalPlayer.Character
pet.LocalScript.Disabled = false
end
end)
script.Parent.MouseButton2Click:connect(function()
if game.Players.LocalPlayer.Character:FindFirstChild("AlphaPet")== true then
local pet = target:Clone()
pet.Parent = game.ServerStorage.Junk
pet.LocalScript.Disabled = true
end
end)

1 comment
You should look into this thread: https://wiki.roblox.com/index.php?title=Building_Games_with_Experimental_Mode_Off