Apprendre
Classe de moteur
Decal

*Ce contenu est traduit en utilisant l'IA (Beta) et peut contenir des erreurs. Pour consulter cette page en anglais, clique ici.


Échantillons de code
Changement de texture de décalque
-- créer une partie
local part = Instance.new("Part")
part.Size = Vector3.new(5, 1, 5)
part.Position = Vector3.new(0, 0.5, 0)
part.Anchored = true
part.TopSurface = Enum.SurfaceType.Smooth
part.BrickColor = BrickColor.new("Dentifrice")
-- créer un décalque
local decal = Instance.new("Decal")
decal.Face = Enum.NormalId.Top
decal.Parent = part
-- définir les visages
local happyFace = Content.fromUri("http://www.roblox.com/asset/?id=26424652")
local sadFace = Content.fromUri("http://www.roblox.com/asset/?id=147144198")
decal.ColorMapContent = happyFace
-- événement touché
local cooldown = false
part.Touched:Connect(function(hit)
if not cooldown then
if hit and hit.Parent then
cooldown = true
sound:Play()
decal.ColorMapContent = sadFace
task.wait(1)
decal.ColorMapContent = happyFace
task.wait(0.2)
cooldown = false
end
end
end)
-- ajouter au workspace
part.Parent = workspace
Décalque de Fading
local TweenService = game:GetService("TweenService")
local part = Instance.new("Part")
part.Size = Vector3.new(10, 10, 1)
part.Position = Vector3.new(0, 5, 0)
part.Anchored = true
part.Transparency = 1
local decal = Instance.new("Decal")
decal.Face = Enum.NormalId.Front
decal.ColorMapContent = Content.fromUri("http://www.roblox.com/asset/?id=699259085") -- logo roblox
decal.Parent = part
part.Parent = workspace
local tween = TweenService:Create(
decal,
TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, -1, true),
{ Transparency = 1 }
)
tween:Play()

Référence API
Propriétés
Color3
Lecture parallèle
Capacités : Basic
Decal.Color3:Color3
Échantillons de code
Couleur3 de Décalcomanie
local TweenService = game:GetService("TweenService")
local part = Instance.new("Part")
part.Size = Vector3.new(10, 10, 1)
part.Position = Vector3.new(0, 5, 0)
part.Anchored = true
part.Transparency = 1
local decal = Instance.new("Decal")
decal.Face = Enum.NormalId.Front
decal.ColorMapContent = Content.fromUri("http://www.roblox.com/asset/?id=1145367640")
decal.Parent = part
part.Parent = workspace
local redTween = TweenService:Create(
decal,
TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),
{ Color3 = Color3.new(1, 0, 0) }
)
local greenTween = TweenService:Create(
decal,
TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),
{ Color3 = Color3.new(0, 1, 0) }
)
local blueTween = TweenService:Create(
decal,
TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),
{ Color3 = Color3.new(0, 0, 1) }
)
while true do
redTween:Play()
redTween.Completed:Wait()
greenTween:Play()
greenTween.Completed:Wait()
blueTween:Play()
blueTween.Completed:Wait()
end

ColorMap
Non répliqué
Lecture parallèle
Capacités : Basic
Decal.ColorMap:ContentId

ColorMapContent
Non répliqué
Lecture parallèle
Capacités : Basic
Decal.ColorMapContent:Content

LocalTransparencyModifier
Caché
Non répliqué
Lecture parallèle
Capacités : Basic
Decal.LocalTransparencyModifier:number

MetalnessMap
Caché
Sécurité des plugins
Lecture parallèle
Capacités : Basic
Decal.MetalnessMap:ContentId

MetalnessMapContent
Sécurité des plugins
Lecture parallèle
Capacités : Basic
Decal.MetalnessMapContent:Content

NormalMap
Caché
Sécurité des plugins
Lecture parallèle
Capacités : Basic
Decal.NormalMap:ContentId

NormalMapContent
Sécurité des plugins
Lecture parallèle
Capacités : Basic
Decal.NormalMapContent:Content

Rotation
Lecture parallèle
Capacités : Basic
Decal.Rotation:number

RoughnessMap
Caché
Sécurité des plugins
Lecture parallèle
Capacités : Basic
Decal.RoughnessMap:ContentId

RoughnessMapContent
Sécurité des plugins
Lecture parallèle
Capacités : Basic
Decal.RoughnessMapContent:Content

Shiny
Déprécié

Specular
Déprécié

Texture
Déprécié

TextureContent
Déprécié

TexturePack
Sécurité Roblox
Lecture parallèle
Capacités : Basic
Decal.TexturePack:ContentId

Transparency
Lecture parallèle
Capacités : Basic
Decal.Transparency:number

UVOffset
Lecture parallèle
Capacités : Basic
Decal.UVOffset:Vector2

UVScale
Lecture parallèle
Capacités : Basic
Decal.UVScale:Vector2

ZIndex
Lecture parallèle
Capacités : Basic
Decal.ZIndex:number

©2026 Société Roblox. Roblox, le logo Roblox et Powering Imagination font partie de nos marques déposées aux États-Unis et dans d'autres pays.