Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Decal changing script doesn't work, for some reason?

Server Script:

remote.OnServerEvent:Connect(function(player,data)
	if data and data["P"] then
		if data.P == "ChangeID" then
			local part = data["Part"]
			if part then
				for i,v in pairs(part:GetChildren()) do
					if v:IsA('Decal') then
						v.Texture = ""
						v.Texture = "rbxassetid://"..tostring(data["ID"])
					end
				end
			end
end
end
end)

local script:

script.Parent:WaitForChild('TextButton').MouseButton1Click:Connect(function()
	game.ReplicatedStorage.MasterRemote:FireServer({["P"]="ChangeID",["ID"]=script.Parent.TextButton.Text,["Part"]=game.Players.LocalPlayer.Character.ProtestFlag.flagpart})
end)

It does change the decal id, it just makes the decal go white. I tried both ways, just putting the ID, and I also tried doing the -1 on the decal ID until the decal image showed up on the web. Nonetheless, both ways make the decal go white.

1 comment

0

I checked inside the part and into the decal and the texture was "rbxassetid://Set ID"

1 answer

This is actually Roblox's fault. They have implemented a stupid way to handle these things. You have to provide the texture id of the decal that you want to change and not the asset id. (Could be other way around).

4 comments

0

So I only put in the ID in the texture? v.Texture = (tostring(data["ID"])) I get another error "Image SetID failed to load in"

0

You still have to do .Texture = "rbxassetid://" .. tostring(data["ID"]) but the user sending the id must be sending the texture id of the asset.

0

On the server Id id .Texture = data["ID"] and on the client side I made it send the ID with the asset link, but its still making it the decal go white.

0

Actually, it works locally... For some reason when I try to print the data["ID"] it prints as "SetID"..

This discussion is preserved as it was. New answers, comments, and votes are closed.