function onClicked(player) game.Players:FindFirstChild(player.Name).leaderstats.Coins.Value = game.Players:FindFirstChild(player.Name).leaderstats.Coins.Value + 100 game.Players.thenasafarouk.leaderstats.Coins.Value = game.Players.thenasafarouk.leaderstats.Coins.Value + 20 game.Workspace.FarmButton.ClickDetector.MaxActivationDistance = 0 game.Workspace.WheatSix.Transparency = 1 game.Workspace.WheatFive.Transparency = 1 game.Workspace.WheatFour.Transparency = 1 game.Workspace.WheatThree.Transparency = 1 game.Workspace.WheatTwo.Transparency = 1 game.Workspace.WheatOne.Transparency = 1 wait(60) game.Workspace.WheatSix.Transparency = 0 game.Workspace.WheatFive.Transparency = 0 game.Workspace.WheatFour.Transparency = 0 game.Workspace.WheatThree.Transparency = 0 game.Workspace.WheatTwo.Transparency = 0 game.Workspace.WheatOne.Transparency = 0 game.Workspace.FarmButton.ClickDetector.MaxActivationDistance = 0 end script.Parent.ClickDetector.MouseClick:connect(onClicked)
It works the first time. Then it stops working afterwards.
You didn't set the MaxActivationDistance back, as I assume you meant to.
function onClicked(player) game.Players:FindFirstChild(player.Name).leaderstats.Coins.Value = game.Players:FindFirstChild(player.Name).leaderstats.Coins.Value + 100 game.Players.thenasafarouk.leaderstats.Coins.Value = game.Players.thenasafarouk.leaderstats.Coins.Value + 20 game.Workspace.FarmButton.ClickDetector.MaxActivationDistance = 0 game.Workspace.WheatSix.Transparency = 1 game.Workspace.WheatFive.Transparency = 1 game.Workspace.WheatFour.Transparency = 1 game.Workspace.WheatThree.Transparency = 1 game.Workspace.WheatTwo.Transparency = 1 game.Workspace.WheatOne.Transparency = 1 wait(60) game.Workspace.WheatSix.Transparency = 0 game.Workspace.WheatFive.Transparency = 0 game.Workspace.WheatFour.Transparency = 0 game.Workspace.WheatThree.Transparency = 0 game.Workspace.WheatTwo.Transparency = 0 game.Workspace.WheatOne.Transparency = 0 game.Workspace.FarmButton.ClickDetector.MaxActivationDistance = 0 -- I assume this should be something else? end script.Parent.ClickDetector.MouseClick:connect(onClicked)