So in my code here:
local cocao = script.Parent
local tweeningService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(20, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local tweenProperties = {Size = cocao.StartSize.Value, Position = cocao.StartPos.Value}
local tween = tweeningService:Create(cocao,tweenInfo,tweenProperties)
local cocoaCollected = false
local cocoaAbleToCollect = true
local deb = false
wait(1)
cocao.Anchored = false
local function collectCocoa(hit)
if not deb then
deb = true
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid ~= nil then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local cocoaStat = player.leaderstats:WaitForChild("Cocoa")
if cocoaStat ~= nil then
if cocoaAbleToCollect then
print("Made it to the collecting phase")
cocoaStat.Value = cocoaStat.Value + (1 * player.Gamepasses.CocoaMultiplier.Value)
cocoaCollected = true
cocoaAbleToCollect = false
cocao.Anchored = true
cocao.Position = cocao.GrowPos.Value
cocao.Size = cocao.GrowSize.Value
cocao.Orientation = cocao.StartRotation.Value
tween:Play()
wait(20.5)
cocoaCollected = false
cocoaAbleToCollect = true
cocao.Anchored = false
deb = false
end
else
warn("No cocoa stat found")
deb = false
end
else
deb = false
end
end
end
cocao.Touched:Connect(collectCocoa)
When the cocoa is touched it starts to grow again. BUT… the Size/Position is a value that’s in the cocoa, and every time I make a duplicate I have to go in and do the same steps over and over again and now I just don’t want to do that.
Here is the explorer view:
If you need more info tell me!