Anyway to fix the decal not appearing on flag part?

I have created a custom ID flag. The thing wrong with it is the decal image not appearing on the flag.

local IS = game:GetService("InsertService")


game:GetService("ReplicatedStorage").FlagEvent.OnServerEvent:Connect(function(plr, id)
	plr.CharacterAdded:Wait()
	
	local Decalasset = IS:LoadAsset(id)
	Decalasset.Parent = workspace
	
	
	local decal = Instance.new("Decal", plr.Backpack.Flag.Part)
		decal.Face = Enum.NormalId.Front
		
	local decal2 = Instance.new("Decal", plr.Backpack.Flag.Part)
		decal.Name = "Decal2"
		decal.Face = Enum.NormalId.Back
	
	decal.Texture = "rbxthumb://type=Asset&id="..id.."&w=420&h=420"
	decal2.Texture = "rbxthumb://type=Asset&id="..id.."&w=420&h=420"
	
	


end)
1 Like

I dont see why you used it here, remove that line.
+
Could we see the client side?

2 Likes

It would give me an error of "Flag is not a valid member of Backpack “Players.anmocha.Backpack”

local gui = script.Parent
local plr = game.Players.LocalPlayer
local event = game:GetService("ReplicatedStorage"):WaitForChild("FlagEvent")

gui.MouseButton1Click:Connect(function()
	event:FireServer(gui.Parent.TextBox.Text)
	plr.PlayerGui:WaitForChild("Flag ID GUI").Enabled = false
end)

Not sure if this is client side

1 Like

For if I remove the “plr.CharacterAdded:Wait()” line.

1 Like

A few notes:

  1. Do not put the parent of instances as an argument. It affects performance.
  2. Have you tried debugging? Use some prints and see what prints and what returns an error.
  3. Change this: plr.PlayerGui:WaitForChild("Flag ID") to plr:WaitForChild("PlayerGui"):WaitForChild("FlagID")
2 Likes

Try to print stuff before and after changing the texture and see what you get.

2 Likes

It’s not giving me a print output at all.

1 Like

How does your script look now?

2 Likes

I don’t really know but this my result:

local IS = game:GetService("InsertService")


game:GetService("ReplicatedStorage").FlagEvent.OnServerEvent:Connect(function(plr, id)
	
	plr.CharacterAdded:Wait()
	
	local Decalasset = IS:LoadAsset(id)
	Decalasset.Parent = workspace
	
	print("hello?")
	
	local decal = Instance.new("Decal")
	decal.Parent = plr.Backpack.Flag.Part
		decal.Face = Enum.NormalId.Front
		
	local decal2 = Instance.new("Decal")
	decal.Parent = plr.Backpack.Flag.Part
		decal.Name = "Decal2"
		decal.Face = Enum.NormalId.Back
	
	print("Player")
	
	


end)
1 Like
  1. Try to add a print right below the OnServerEvent(inside).

  2. Do you have “flag” in your backpack?

2 Likes

It printed an output right above the scripts inside the OnServerEvent.

Yes I do.

1 Like

If the print below these lines didnt print out, meaning we have an issue with these lines.

Alright, so now maybe try to print stuff like the asset name etc, to see that this part works

2 Likes

what do you mean?
like print stuff like the ID etc?

2 Likes

Yes. Part of debugging is to print variables,instances, etc…

2 Likes

Yeah doesn’t work, I’m not sure what the problem is.

1 Like

What type of script are you using (LocalScript or Script) and where is it located?

Why not put the decals on Flag.Part in the tool, with the Face (Front or Back) already there?

2 Likes

plr.CharacterAdded:Wait() was yielding until character respawns

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ContentProvider = game:GetService("ContentProvider")
local IS = game:GetService("InsertService")

local FlagEvent = ReplicatedStorage:WaitForChild("FlagEvent")

FlagEvent.OnServerEvent:Connect(function(plr, id)
	local Decalasset = IS:LoadAsset(id) -- i dont know what this meant to be
	Decalasset.Parent = workspace
	
	local decal = Instance.new("Decal", plr.Backpack.Flag.Part)
	decal.Face = Enum.NormalId.Front
		
	local decal2 = Instance.new("Decal", plr.Backpack.Flag.Part)
	decal.Face = Enum.NormalId.Back
	decal.Name = "Decal2"

	ContentProvider:PreloadAsync({
		"rbxthumb://type=Asset&id="..id.."&w=420&h=420"
	})
	
	decal.Texture = "rbxthumb://type=Asset&id="..id.."&w=420&h=420"
	decal2.Texture = "rbxthumb://type=Asset&id="..id.."&w=420&h=420"
end)
2 Likes
local Game = game
local Workspace = workspace
local Replicated = Game:GetService("ReplicatedStorage")

Replicated.FlagEvent.OnServerEvent:Connect(function(Player, Id)
	local Character = Player.Character
	local Backpack = Player:FindFirstChildOfClass("Backpack")
	if not (Character or Backpack) then return end
	local Flag = Character:FindFirstChild("Flag") or Backpack:FindFirstChild("Flag")
	if not Flag then return end

	local Decal1 = Instance.new("Decal")
	Decal1.Texture = "rbxthumb://type=Asset&id="..Id.."&w=420&h=420"
	Decal1.Face = Enum.NormalId.Front
	Decal1.Parent = Flag.Part

	local Decal2 = Instance.new("Decal")
	Decal1.Texture = "rbxthumb://type=Asset&id="..Id.."&w=420&h=420"
	Decal2.Face = Enum.NormalId.Back
	Decal2.Parent = Flag.Part
end)

You don’t need to use the InsertService to load decals.

1 Like

i dunno why but i feel his script is in workspace or any storage. I want to remind you that the scripts wont work if its not placed in

Tool
StarterGUI
Etc. (i forgor)

2 Likes