Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- game.ReplicatedStorage.Accessories.Events.GiveAccessory1.OnServerInvoke = function(player, GobletName)
- if debounce == true then
- debounce = false
- --print("RemoteFunction fired")
- local GobletifsInInventory ;
- if player.Backpack:FindFirstChild("Goblet") then
- GobletifsInInventory = true
- end
- if Goblet then
- if Goblet:FindFirstChild("Price") then
- if not GobletifsInInventory then
- -- Check if we can buy the Item
- if player.leaderstats.Coins.Value >= Goblet.Price.Value then
- print(player.Name.." brought the ".. Goblet.Name.." item")
- player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - Goblet.Price.Value
- local bool = Instance.new("BoolValue",player.AccessoriesInventory); bool.Name = Goblet.Name
- local giveTool = ReplicatedStorage.Accessories:FindFirstChild(Goblet.Name):Clone()
- giveTool.Parent = player.Backpack
- local giveTool2 = ReplicatedStorage.Accessories:FindFirstChild(Goblet.Name):Clone()
- giveTool2.Parent = player.StarterGear
- return "Brought"
- else
- return "NotEnough"
- end
- else
- -- You already owned it
- if player.AccessoriesInventory:FindFirstChild("EquippedAccessories"):FindFirstChild("EquippedGoblet").Value ~= Goblet.Name and GobletifsInInventory == true then
- debounce = false
- player.AccessoriesInventory:FindFirstChild("EquippedAccessories"):FindFirstChild("EquippedGoblet").Value = Goblet.Name
- local giveTool = ReplicatedStorage.Accessories:FindFirstChild(Goblet.Name):Clone()
- giveTool.Parent = player.Backpack
- local giveTool = ReplicatedStorage.Accessories:FindFirstChild(Goblet.Name):Clone()
- giveTool.Parent = player.StarterGear
- wait(1)
- debounce = true
- return "Equip"
- else
- player.AccessoriesInventory:FindFirstChild("EquippedAccessories"):FindFirstChild("EquippedGoblet").Value = ""
- local itemName = "Goblet" --Change this
- local Char = player.Character or player.CharactedAdded:Wait()
- local GearInCharacter = Char:findFirstChild("Goblet")
- if player.Backpack:FindFirstChild(itemName) and player.Backpack[itemName]:IsA("Tool") then
- player.Backpack.Goblet:Destroy()
- player.Backpack.Goblet:Destroy()
- player.StarterGear:FindFirstChild("Goblet"):Destroy()
- player.StarterGear:FindFirstChild("Goblet"):Destroy()
- end
- wait(1)
- debounce = true
- return "Unequip"
- end
- end
- end
- end
- end
- wait(1)
- debounce = true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement