Can't change texture with Server Script?

I know that there are many topic like this, however none of them worked for me.

I’m trying to change a MeshPart’s texture throught a Server Script (inside a ClickDetector). The texture changes, but there isn’t any visual effect.

MeshPart.TextureID = "rbxassetid://1234567890"

My only clue is that the texture isn’t loaded because of the image error. I don’t know how to “load it”.

Any help appracticed!

2 Likes

Is the 1234567890 ID the actual ID? Also, if you are using the InsertService, you can change textures without it.

1 Like

No that ID is just a placeholder, i am not using InsertService in any script.

If you aren’t using insert service, the error isn’t because of that. Can you show me what happens in the output when you try to load it? I once tried changing the texture of a meshpart with the dev console and I think it errored

The problem is that you can’t use InsertService on the Client. You need to use a Server Script instead.

Nothing happens in the output window. No errors. No warnings.

I’m not using Insert Service.


Please forget it. Could someone help with the texture not changing if possible?

try it, im not sure if its gonna work
(EDIT: accidently cut-off the image)

local image = "rbxassetid://10244612505"
local meshpart = script.Parent.Parent --put the meshpart here 
script.Parent.MouseClick:Connect(function()
	script.Parent.Parent.TextureID = image
end)

<Texture>.Texture, not <Texture>.TextureID, is it not?

Tl;dr “TextureId” isn’t a property in Texture.

(Min characters)

MeshPart has “TextureID”, not “Texture”.

Have you tried setting it manually and see what it says?

What do you mean manually?

chlimit

In studio, go and set it as your desired ID.

Works obviously, its just that there is no visual change after the texture was changed (in-game).

Tried this already, doesn’t work.

can you show some parts of the script so i can look for the issue?

cookedTexture = "1203306754"
rawTexture = "1203306754"

local Meat1 = script.Parent.Parent.Parent.Meat1
local Meat2 = script.Parent.Parent.Parent.Meat2
local Meat3 = script.Parent.Parent.Parent.Meat3
local Meat4 = script.Parent.Parent.Parent.Meat4
local Machine = script.Parent.Parent.Parent.Machine

script.Parent.Triggered:Connect(function(player)
		if player.leaderstats.Patties.Value >= 4 then
		player.leaderstats.Patties.Value -= 4
		script.Parent.MaxActivationDistance = 0
		task.wait(0.2)


		Meat1.Transparency = 0
		task.wait(0.8)
		Meat2.Transparency = 0
		task.wait(1)
		Meat3.Transparency = 0
		task.wait(0.7)
		Meat4.Transparency = 0
		task.wait(1.5)
		for i = 1,61 do
			Machine:SetPrimaryPartCFrame(Machine.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(0.01,0,0))
			task.wait()
		end
		task.wait(0.5)
		game:GetService("TweenService"):Create(script.Parent.Parent.frying,TweenInfo.new(1),{Volume = 0.5}):Play()
		script.Parent.Parent.frying:Play()
		script.Parent.Parent.Parent.Smoke.Smoke.Enabled = true
		
		task.wait(4)

-- // texture change
		
		Meat1.TextureID = cookedTexture
		Meat2.TextureID = cookedTexture
		Meat3.TextureID = cookedTexture
		Meat4.TextureID = cookedTexture

--//

		task.wait(5)
		
		game:GetService("TweenService"):Create(script.Parent.Parent.frying,TweenInfo.new(1),{Volume = 0}):Play()
		task.wait(1)
		script.Parent.Parent.frying:Stop()
		script.Parent.Parent.Parent.Smoke.Smoke.Enabled = false
		
		for i = 1,61 do
			Machine:SetPrimaryPartCFrame(Machine.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(-0.01,0,0))
			task.wait()
		end
-- // tbc
	end
end)

use specialmesh instead of meshpart, might work better.

The path seems to be correct. I don’t know why it errors.

change TextureID to TextureId, chat limit be like lolololo