SurfaceAppearance gone in-game but not Studio

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

I’m pretty sure SurfaceAppearance aren’t live for Roblox yet.

Here’s the assets fully put together and unscripted on a server. It’s live!

Weird, I have no idea what’s the issue either, but something tells me that SurfaceAppearance is only for meshes? I could be wrong, so correct me.

Never mind, you can’t do it when’s using scripts.

The problem was not having all the MeshParts loaded. I tried making a couple new tables for the parts and textures to load, then used

ContentProvider:PreloadAsync(value)
and it worked!

You can :Clone()

And parent that from ReplicatedStorage to client.

1 Like