Make sure this script isn't in the regen brick, cause if it is it will delete the brick and the script so put this is the ServerScriptService or in the Workspace and change the names of delete to the name of the brick and make sure its pointing to the right directory
local Apple = game.Workspace:WaitForChild("Apple")
local Clicker = Apple:WaitForChild("ClickDetector")
local Worth = 1
local regen = delete:Clone()
local duration = 120
game.Workspace.ChildAdded:connect(function(Child)
if Child.Name == "Apple" then
Apple = Child
Clicker = Child:WaitForChild("ClickDetector")
Clicker.MouseClick:connect(function(Player)
local Money = Player:FindFirstChild("Money")
if Money ~= nil and Apple ~= nil then
Money.Value = Money.Value + Worth
game:GetService:AddItem(Apple, 0)
else
print("Money Or Apple Doesn't Exist")
end
end)
else
end
end)
while wait(duration) do
if Apple ~= nil then
game:GetService("Debris"):AddItem(Apple, 0)
local clone = regen:Clone()
clone.Parent = game.Workspace clone:MakeJoints()
Apple = clone
else
end
end
5 comments
But then the script doesnt work with the other script
Here I edited this for you
Try putting a script in the server script service and adding this script to it, I took your scripted and modified it to work. as 1 script
Workspace.Handle.Script:16: function arguments expected near ':'
Thats your fault why would you put this in a tool?