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)
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)
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.