Is there any way to make a texture move? the movement rate of the texture is similiar to the velocity of the part
A texture is static, however it has an an offset property to give a false sense it is moving.
All you have to do is create a loop that increases or decreases the texture’s OffsetStudsU
and/or OffsetStudsY
in some type of way. Let me show you a quick example:
This is the hierarchy:
This is the script:
game:GetService("RunService").Stepped:Connect(function(t, delta)
script.Parent.Texture.OffsetStudsU = script.Parent.Texture.OffsetStudsU + delta * 10
end)
And this is the result:
can i run this on local script?
Yes, you can. But it the texture moving won’t be replicated to other clients, only that client itself. Which, I don’t think you need to worry about.
for i,v in pairs(game.Workspace.InGameObby:GetChildren()) do
for x,y in pairs(v:GetChildren()) do
for a,b in pairs(y:GetChildren()) do
if b.Name == "Conveyor" or b.Name == "conveyor" then
game:GetService("RunService").Stepped:Connect(function(t, delta)
b.ConveyorTexture.OffsetStudsV = b.ConveyorTexture.OffsetStudsV + delta * -10
end)
end
end
end
end
all of my obbies run on client so that the players lag wont affect other player’s performance
so i made this for loop that check when a child of a stage is named conveyor then it run the code that you send here to the child of that conveyor which is the texture but it’s not moving i wonder why
You should replace this:
b.ConveyorTexture.OffsetStudsV = b.ConveyorTexture.OffsetStudsV + delta * -10
to that:
b.ConveyorTexture.OffsetStudsY = b.ConveyorTexture.OffsetStudsY + delta * -10
this only change the directory of the moving texture i dont want the texture to produce the wave sideways i want it forward thats why i made it v
OffsetStudsV
isn’t a property of texture, so thats why you texture is not moving.
then maybe this code solves your issue?
b.ConveyorTexture.OffsetStudsU = b.ConveyorTexture.OffsetStudsU+ delta * -10
b.ConveyorTexture.OffsetStudsY
is not a property of a texture
b.ConveyorTexture.OffsetStudsV
is a property of a texture
Instead of having an abnormal amount of in pairs loops, you can do the same thing with just one.
Instance:GetDescendants() gets the children of children of children, etc. Basically everything that is under it.
Try this and see if it works:
for _, v in pairs(game.Workspace:GetDescendants()) do
if v.Name == "Conveyor" or v.Name == "conveyor" then
local conveyorTexture = v.ConveyorTexture
game:GetService("RunService").RenderStepped:Connect(function(delta)
conveyorTexture.OffsetStudsV = conveyorTexture.OffsetStudsV + delta * 10
end)
end
end
This is still highly unoptimized, as it creates a RunService loop for every single conveyor in existence. In the future, I’d recommend trying different methods.
The conveyor is still not moving
oh, sorry about that.
Also, why aren’t using :GetDescendants()
? It’s a better solution for get all instances.
(code untested)
GetService("RunService").Stepped_Connect(function(t, delta)
for i,v in pairs(game.Workspace.InGameObby:GetDescendants()) do
if b.Name == "Conveyor" or b.Name == "conveyor" then
b.ConveyorTexture.OffsetStudsV = b.ConveyorTexture.OffsetStudsV + delta * -10
end)
end
end
And there’s no errors?? I need to know if there’s any errors.
sktvladimir535 applied edits to script Conveyor
17:25:03.842 - Stairs of Hell [ALPHA] @ 02 Nov 2020 17:25 auto-recovery file was created
Replaced
enabled
sktvladimir535 doesn't own x2 EXP Gamepass
sktvladimir535 doesn't own x2 Coins Gamepass
Updated!
Updated!
Updated!
Resetted
sktvladimir535 Resetted
Resetted
sktvladimir535 Resetted
Resetted
sktvladimir535 Resetted
Resetted
sktvladimir535 Resetted
Resetted
sktvladimir535 Resetted
Resetted
sktvladimir535 Resetted
Updated!
Updated!
Updated!
There are no errors
Maybe wait a few seconds before you call those lines, as certain objects may not be instanced in yet.
Try a wait(5)
before everything.
Anyways, it’s 4:30am for me, and I haven’t slept, so I have to go now unfortunately. Good night!