local grass
repeat
grass = workspace.GrassFolder:FindFirstChildWhichIsA(“Model”)
task.wait()
until grass
stop trying to make it complicated, remote events and bindables are not needed, and will mess with performance, just use this.
also, @AamTum, use task.wait(). wait() is deprecated and should never be used in modern projects.
task.wait() is the same but more accurate and just a overall better practice.
(btw i put this script on moduleScript)
local grass
repeat
grass = workspace.GrassFolder:FindFirstChildWhichIsA(“Model”)
task.wait()
until grass
when the old :FindFirstChildWhichIsA(“Model”) grass is destroyed (by server caused by other script)
and new cloned grass by other script gave me an error
Grass1 is not a valid member of Folder “GrassFolder”
yeah, thats because whenever something is destroyed then the parent becomes nil (its gone)
so youd have to check for when the grass is destroyed to define a new grass
ex:
local grass
local function GetGrass()
repeat
grass = workspace.GrassFolder:FindFirstChildWhichIsA(“Model”)
task.wait()
until grass
end)
grass.Destroying:Connect(function()
GetGrass()
end)
local grass
local function GetGrass()
repeat
grass = workspace.GrassFolder:FindFirstChildWhichIsA(“Model”)
task.wait()
until grass
grass.Destroying:Connect(function()
GetGrass()
end)
end)