so, I am making a farming system for a game, but I do not want a system where you place water and it grows, I want it grow over time (7.5 minutes), how would I do this? I have 4 separate models for each stage.
Can’t you just tween the crop growing on the client with the length of 7.5 minutes, while on the server it waits 7.5 minutes until the crop is collectable?
the thing is, I do not know enough scripting to call myself a “professional”, so I am not sure if I understand how to do that.
So first off, I’ll just list the steps:
-
Fire a remote event to the server that has the place where the player wants to plant their crop.
-
I’m not sure how you’re doing the watering system, but you would also have to fire a remote event when the player waters their plant so the server knows the plant is watered. The server then waits 7.5 minutes until you can collect the crop
-
Switch out the crop models every 7.5 minutes /4 on the server to show the growing. (or client)
-
When the player harvests the crop, fire a remote event to the server so that the server knows its been harvested (add sanity checks)
They said they had 4 separate models for intermediates of the growing process, so instead of tweening size every 4th of the overall time they would change the model
Oh yea, sorry I didn’t read that part.
well, I was thinking about, deleting the model and then cloning the other model onto the same position as the model before it, would that work?
Yes it would (i have hearted why max chars still here)
Yes, that would work.
alright! I will try and see if I am able to do it.
If you need a helper script i have one for you
Use a UNIX timestamp and share it with a client, use a module to determinate each stage on both server and client.
he said he wasnt a professional i dont think he knows what you are saying
I think I would probably need that as I am already pretty lost.
Untested:
local cframe -- CFrame of where you want the plant to be
local timeInSeconds = 7.5*60 -- time in seconds of how long you want the plant to grow
local allModels = {
-- Models
}
local curModelIndex = 1 -- index of current model
local curModel
while curModelIndex < 4 do
if curModel then
curModel:Destroy()
end
curModel = allModels[curModelIndex]:Clone()
curModel:SetPrimaryPartCFrame(cframe)
curModel.Parent = workspace
task.wait(timeInSeconds/#allModels)
curModelIndex += 1
end
-- crop growing done
Idk why the formatting messed up
I will try it and reply if anything.
By the way you have to delete the previous model before creating the new one i will edit and update with that
alrightㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ
If I may ask, after cframe
in the code you gave me, is it perhaps missing something after?