I have some animated foliage. I want to add or remove SurfaceAppearances based on distance.
My LocalScript works perfectly fine on the Client within Roblox Studio. Once I start a server, the textures don’t show up, and I don’t get an error message.
Seems that nothing works, from what I can tell. It must be a simple thing I’m overlooking. Can’t find any results.
local Bushtex1 = ReplicatedFirst.Bushtex1
local Bushtex2 = ReplicatedFirst.Bushtex2
local Bushtex3 = ReplicatedFirst.Bushtex3
local Treetex1 = ReplicatedFirst.Treetex1
local Treetex2 = ReplicatedFirst.Treetex2
local Planttex1 = ReplicatedFirst.Planttex1
local Planttex2 = ReplicatedFirst.Planttex2
function addTexture(v)
if not v:FindFirstChildWhichIsA("SurfaceAppearance") then
if v.Name == "Bush1mesh" then
local tex = Bushtex1:Clone()
tex.Parent = v
else
if v.Name == "Bush2mesh" then
local tex = Bushtex2:Clone()
tex.Parent = v
else
if v.Name == "Bush3mesh" then
local tex = Bushtex3:Clone()
tex.Parent = v
else
if v.Name == "Tree1mesh" then
local tex = Treetex1:Clone()
tex.Parent = v
else
if v.Name == "Tree2mesh" then
local tex = Treetex2:Clone()
tex.Parent = v
else
if v.Name == "Plant1mesh" then
local tex = Planttex1:Clone()
tex.Parent = v
else
if v.Name == "Plant2mesh" then
local tex = Planttex2:Clone()
tex.Parent = v
end
end
end
end
end
end
end
end
end