I need to make a texture animated on a gun model. I need to use only 1 texture instance for this instead of 6 (On for each face). How would I do this. Thanks!
You’re going to have to put a texture instance for each face to animate it. Not too hard though, you can just create a function to do that for you.
local function CreateFaceTextures(Part, TextureId)
local FaceTypes = Enum.NormalId:GetEnumItems()
local TextureUrl = "rbxassetid://" .. TextureId
local Textures = {}
for i, FaceType in pairs(FaceTypes) do
local Texture = Instance.new("Texture")
Texture.Face = FaceType
Texture.Texture = TextureUrl
Texture.Parent = Part
table.insert(Textures, Texture)
end
return Textures
end
local Textures = CreateFaceTextures(script.Parent, 247707396)
--// then iterate over Textures and animate those instances
Texture instances have a OffsetStudsU and OffsetStudsV property which can be used to offset the texture.
You can have a loop running at all times to update all texture’s OffsetStudsU
and OffsetStudsV
to “animate” the texture.
Also a related post that has an answer for this specific question, and also has a code example.
I said in the op I can’t use one on each face because it lags too much.
that is not possible, the only ways of making moving texture in roblox is
placing 6 textures and changing the values of the image for making it slide.
or adding 1 texture and chaning the id to a bunch of others textures.
but for this you need a bunch of images of the texture that you want sliding a bit per frame.
in any case cause lag, or is lag by memory lag or is lag by internet usage when loading the images.
roblox still limited alot compared to others game engine.
nintendo 64 and playstation 1 had mesh deformation/aka skinned mesh in 1996 and texture sliding.
while roblox got this year the mesh deformation/skinned mesh.
Im just gonna make it so you can only see your own guns animations and see if that works