RenderStepped not working?

Attempting to make TextureID of a mesh continuously change via FireAllClients(). It doesn’t seem to be working and the texture stays the same, all help appreciated.


Local Script


Module Script

In your local script I can see creating texture function without calling it. This is what I mean:

-- Some code above
local function texture(part)
-- Some code of the function
end
texture(part) -- Calling the function made above, I couldn't find it in your code
-- The rest of the code

Calling the function in the local script gives this error:

Im almost 100% sure because the first parameter given to the function is nil. You can check it by changing your function to something like this:

local function texture(Part)
print("Is the given parameter nil:", Part == nil)
-- The rest of the function
end

Run this modified function and check result.

You’re right. How would I assign the parameter to the ball instance? Wouldn’t it theoretically be possibly to achieve the same thing I’m going for by running the table through an in pairs loop?

Also, if you are just going to run the effect on all clients, why not just do the effect on the server?

1 Like

What is barrage in your local script? I’m sorry for answering your questions with a question but I think this might help.
Edit: Actually nevermind

If you do it all in the same code on the server, instead of trying to fire it on all clients; it would be like this:

local ids = {
"your id tablehere",
}

local function texture(Part)
	--Your texture Code here.
end

spawn(function()
	local ball = WaterFolder:WaitForChild("Barrage"):Clone()
	ball.Parent = workspace.MoveParts
	ball.Position = HRP.CFrame * Vector3.new(0,0,0)
	ball.Size = ball.Size - Vector3.new(.8,.8,.8)
	local bp = Instance.new("BodyPosition",ball)
	bp.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
	bp.Position = ball.Position
	ball.Orientation = HRP.Orientation + Vector3.new(0,0,0)
	local ba = Instance.new("BodyAngularVelocity", ball)
	ba.AngularVelocity = Vector3.new(0,-2.3,0)

	texture(ball)
end)

At least based on the code visible to me

To solve the problem of the nil parameter I think that you should send one more thing from server to clients by using the remote event - ball to move. 23rd line of local script should look something like this:
game.ReplicatedStorage.Main.Remote.OnClientsEvent:Connect(function(barrage, character, ball) -- Object reference of this part is being sent as the first parameter of the event's function
Now the script has to put a part as the parameter of the texture function:

local function texture(Part)
-- Some code
end
texture(ball) -- Definied the parameter here

Edit: I gotta go to sleep because I’m tired. Hopefully others can help you if more help is needed.

If memory serves me, you cannot change the texture of a MeshPart when the game’s running, only in studio pre-made with the texture. Your program is confusing because you’re sending a string to the client and not a mesh. Is there another part of the code that’s calling the remote? And is the module being required by a server Script?

Edit 8/11/2021

With a SpecialMesh it’s possible, but not with a MeshPart. You hadn’t answered my questions btw.

1 Like

This is correct, the “TextureID” of a “MeshPart” instance is unscriptable, it can only be modified directly in studio in the properties window or through the command bar, not when the game is live in a script.

Because the server shouldn’t handle something that can be done on the client, doing it on the server creates extra lag and with enough going on can start breaking your game, firing a remote to all clients is basically instant and once its fired creates no more lag.

Wrong, it is possible. Certain visual effects require constant TextureID change. I’ve done it before, but I’m going the extra mile this time to make it lagfree.

Did you check if you are even calling the function?