Created
July 30, 2021 16:57
-
-
Save RobertCodez/969bebe26b8ffd39e9969c6cb9533564 to your computer and use it in GitHub Desktop.
Proximity Prompts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local ProximityPromptService = game:GetService("ProximityPromptService") | |
local function onPromptTriggered(promptObject, player) | |
end | |
local function onPromptHoldBegan(promptObject, player) | |
end | |
local function onPromptHoldEnded(promptObject, player) | |
if promptObject.Name == "HatchEgg" then | |
game.ReplicatedStorage.GuiReplicator:FireClient(player, "HatchEggUI", promptObject.Parent.Parent.Parent.Type.Value, promptObject.Parent.Parent.Parent.Price.Value) | |
elseif promptObject.Name == "ChickenBuy" then | |
local realPrice = 10 | |
local index = 1 | |
for _,v in pairs(player.ChickensOwned:GetChildren()) do | |
index = index + 1 | |
if realPrice == 10 then | |
realPrice = 200 | |
else | |
realPrice = realPrice * 2 | |
end | |
end | |
game.ReplicatedStorage.GuiReplicator:FireClient(player, "BuyChicken", "CHICKEN #"..index, realPrice) | |
end | |
end | |
ProximityPromptService.PromptTriggered:Connect(onPromptTriggered) | |
ProximityPromptService.PromptButtonHoldBegan:Connect(onPromptHoldBegan) | |
ProximityPromptService.PromptButtonHoldEnded:Connect(onPromptHoldEnded) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment