Skip to content

Instantly share code, notes, and snippets.

@Ahosall
Created October 15, 2021 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ahosall/e3d9bade68b33f096e95bd3bf87d7c07 to your computer and use it in GitHub Desktop.
Save Ahosall/e3d9bade68b33f096e95bd3bf87d7c07 to your computer and use it in GitHub Desktop.
local button = script.Parent
local tycoon = script.Parent.Parent.Parent
local Cash = game.ReplicatedStorage.Cash
local dropper = script.Parent.Parent.Dropper
local objectsFolder = tycoon.Objects
local cooldown = false
local timer = 1.4
local function getPlayer(part)
local character = part.Parent
if character then
local player = game.Players:GetPlayerFromCharacter(character)
return player
end
end
local function dropObject()
local newPart = Cash:Clone()
newPart.Position = dropper.Position
newPart.Parent = objectsFolder
end
local function Touch(part)
local player = getPlayer(part)
print(tycoon.TycoonOwner)
if not tycoon.TycoonOwner.Value then
return
end
if player then
if cooldown then
return
end
cooldown = true
dropObject()
wait(timer)
cooldown = false
end
end
button.Touched:Connect(Touch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment