My decal doesn’t apply to the stick somewhy
local frame = script.Parent:WaitForChild("Frame")
local decalIdTextbox = frame:WaitForChild("decalid")
local updateButton = frame:FindFirstChild("UpdateButton")
local function updateDecalImage()
local player = game.Players.LocalPlayer
local character = player.Character
local backpack = player:FindFirstChild("Backpack")
local tool = backpack and backpack:FindFirstChild("stick") or (character and character:FindFirstChild("stick"))
if not tool then
warn("[UpdateDecal] Tool 'stick' not found in Backpack or Character")
return
end
print("[UpdateDecal] Found tool:", tool.Name)
local hockeyBottom = tool:FindFirstChild("HockeyBottom")
if not hockeyBottom then
warn("[UpdateDecal] HockeyBottom part not found in stick tool")
return
end
print("[UpdateDecal] Found HockeyBottom")
local decalId = decalIdTextbox.Text
local numericId = decalId:match("%d+")
if not numericId then
warn("[UpdateDecal] Invalid decal ID entered:", decalId)
return
end
print("[UpdateDecal] Parsed decal ID:", numericId)
local oldDecal = hockeyBottom:FindFirstChild("HockeyDecal")
if oldDecal then
oldDecal:Destroy()
end
local newDecal = Instance.new("Decal")
newDecal.Name = "HockeyDecal"
newDecal.Texture = "rbxassetid://" .. numericId
newDecal.Face = Enum.NormalId.Front
newDecal.Parent = hockeyBottom
print("[UpdateDecal] Applied new decal with ID:", numericId)
hockeyBottom.Transparency = 0
end
decalIdTextbox.FocusLost:Connect(function(enterPressed)
if enterPressed then
updateDecalImage()
end
end)
if updateButton then
updateButton.MouseButton1Click:Connect(updateDecalImage)
else
warn("[UpdateDecal] UpdateButton not found inside Frame")
end