Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function RF.OnServerInvoke(player, request, data)
- local id = player.UserId
- local farm = workspace.Farms:FindFirstChild(player.Name)
- local land = farm.Land
- if request == "placement" then
- local object, slot = data[1], data[2]
- local result = dataCache[id].grid:AddSlot(slot, object)
- if result then
- local objectClone = RS.Land:FindFirstChild(object):Clone()
- if objectClone:FindFirstChild("HarvestTime") then
- local timeStage2 = objectModule[object].HarvestTimeAmount * (3/4)
- local timeStage3 = objectModule[object].HarvestTimeAmount * (1/4)
- local harvestTime = objectClone:FindFirstChild("HarvestTime")
- objectClone.Parent = land
- objectClone.Name = slot
- objectClone:SetPrimaryPartCFrame(CFrame.new(land:FindFirstChild(slot).PrimaryPart.Position))
- land:FindFirstChild(slot):Destroy()
- spawn(function()
- if harvestTime then
- harvestTime.Value = objectModule[object].HarvestTimeAmount
- end
- while harvestTime do
- if harvestTime.Value == 0 then
- growCrop(objectClone:FindFirstChild("Stage3"), objectClone:FindFirstChild("Stage4"), false)
- objectClone.PrimaryPart:FindFirstChild("TimeGui").Time.Text = "Harvest"
- break
- elseif harvestTime.Value == timeStage2 then
- growCrop(objectClone:FindFirstChild("Stage1"), objectClone:FindFirstChild("Stage2"), false)
- elseif harvestTime.Value == timeStage3 then
- growCrop(objectClone:FindFirstChild("Stage2"), objectClone:FindFirstChild("Stage3"), false)
- end
- wait(1)
- if objectClone.PrimaryPart then
- if objectClone.PrimaryPart:FindFirstChild("TimeGui") then
- harvestTime.Value = harvestTime.Value - 1
- objectClone.PrimaryPart:FindFirstChild("TimeGui").Time.Text = timeFormat(harvestTime.Value)
- end
- end
- end
- end)
- else
- objectClone.Parent = workspace.Farms:FindFirstChild(player.Name).Land
- objectClone.Name = slot
- objectClone:SetPrimaryPartCFrame(CFrame.new(land:FindFirstChild(slot).PrimaryPart.Position))
- workspace.Farms:FindFirstChild(player.Name).Land:FindFirstChild(slot):Destroy()
- end
- local grid = dataCache[player.UserId].grid
- printGrid(grid.board)
- return true
- else
- return false
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement