I created a script that is supposed to clone wheat, it is in replicated storage.
Script:
print("works on line 1") local Wheat = game.ReplicatedStorage.Farm.Wheat:Clone(); print("works on line 2") Wheat.Parent = game.Workspace; print("works on line 3") script:Destroy(); print("works on line 4") print("works on line 5")
and it didnt even print on line 1, sorry about this, I never did lua in a while.
this is now how it looks like
local ReplicatedStorage = game:GetService("ReplicatedStorage") local Farm = ReplicatedStorage:WaitForChild("Farm") local Wheat = Farm:WaitForChild("Wheat") local xpos = -161.75 local zpos = 48.375 local Count = 0 local Count2 = 0 local ifyethappend = true while Count < 32 do local WheatClone = Wheat:Clone() WheatClone.Parent = game.Workspace WheatClone.Name = "Wheat" WheatClone.Position = Vector3.new(WheatClone.Position.x, WheatClone.Position.y, zpos) while Count2 < 32 do local WheatClone2 = WheatClone:Clone() WheatClone2.Parent = game.Workspace WheatClone2.Name = "Wheat" if ifyethappend == true then WheatClone2.Position = Vector3.new(xpos, WheatClone.Position.y, WheatClone.Position.z) ifyethappend = false else WheatClone2.Position = Vector3.new(xpos, WheatClone2.Position.y, WheatClone2.Position.z) end xpos = xpos - 3 Count2 = Count2 + 1 if Count2 == 31 then ifyethappend = true end end xpos = -161.75 zpos = zpos - 3 Count = Count + 1 Count2 = 0 end local Count = 0 script:Destroy()
I wrote this exact script into my game just with parts and it worked fine, even placed the part into workspace.
The issue seems to be that you either are trying to get the replicatedstorage.Farm before Farm is actually in the storage or there simply is no such thing as Farm located in replicated storage.
Make sure you place this script into ServerScriptService
local ReplicatedStorage = game:GetService("ReplicatedStorage") local Farm = ReplicatedStorage:WaitForChild("Farm") local Wheat = Farm:WaitForChild("Wheat") local WheatClone = Wheat:Clone() Wheat.Parent = game.Workspace script:Destroy()
Now, since I don't exactly know your issue I placed a few (Maybe) unnecessary "WaitForChild"s.
Make sure this script is in ServerScriptService and also make sure you actually have Farm and wheat in the correct places!
it ends up, the script was being skiped because it was in replicated storage, now on I will leave it in server script service.