Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- game.ReplicatedStorage.Events.BuyItem.OnServerInvoke = function(player, BluetrailName)
- if debounce == true then
- debounce = false
- print("RemoteFunction fired")
- local ifsInInventory
- if player.TrailInventory:FindFirstChild("Blue") then
- ifsInInventory = true
- end
- if Bluetrail then
- if Bluetrail:FindFirstChild("Price") then
- if not ifsInInventory then
- -- Check if we can buy the trail
- if player.leaderstats.Coins.Value >= Bluetrail.Price.Value then
- print(player.Name.." brought the ".. Bluetrail.Name.." trail")
- player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - Bluetrail.Price.Value
- local bool2 = Instance.new("BoolValue",player.TrailInventory); bool2.Name = Bluetrail.Name
- return "Brought"
- else
- return "NotEnough"
- end
- else
- -- You already owned it
- if player.EquippedTrail.Value ~= Bluetrail.Name and ifsInInventory then
- player.EquippedTrail.Value = Bluetrail.Name
- -- print(player.Name.." equipped the ".. Bluetrail.Name.." trail")
- wait(1)
- debounce = true
- return "Equip"
- else
- player.EquippedTrail.Value = ""
- --print(player.Name.." unequipped the ".. Bluetrail.Name.." trail")
- wait(1)
- debounce = true
- return "Unequip"
- end
- end
- end
- end
- end
- wait(5)
- debounce = true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement