Hi, I’m currently trying to change a model material and color but they don’t work, I already looked at many Devforum posts but can’t seem to find the right one.
This is the script:
for i, part in pairs(Aircraft:GetDescendants()) do
if part:IsA("BasePart") or part:IsA("MeshPart") or part:IsA("UnionOperation") then
part.Material = Enum.Material.CorrodedMetal
part.BrickColor = BrickColor.new("Dark stone grey")
print("CRASHED")
There are no errors on the output and i tried everything like is a meshpart is a basepart is a unionoperation but it still doesn’t work. It works somehow like this:
I had to activate the script 3 times and it makes 3 random parts activated
I tested it, yes it was the debounce. But I need the debounce for my aircraft so the explode sound doesn’t spam. So i don’t really know what i should use
local Seat = script.Parent.Seat
local Hitbox = script.Parent.Parent.Body.CollisionPart
local Engine = script.Parent.Parent.VehicleEngine
local ExplosionSmall = script.ExplosionSmall
local ExplosionBig = script.ExplosionBig
local ImpactSoundSmall = script.ImpactSoundSmall
local ImpactSoundBig = script.ImpactSoundBig
local Aircraft = script.Parent.Parent.Parent.AircraftModel
Hitbox.Touched:Connect(function(hit)
if Seat.Velocity.Magnitude >= 80 and hit then
ImpactSoundSmall:Play()
ImpactSoundBig:Play()
ExplosionSmall:Clone()
ExplosionSmall.Parent = Engine
ExplosionSmall:Emit(150)
ExplosionBig:Clone()
ExplosionBig.Parent = Engine
ExplosionBig:Emit(150)
for i, part in pairs(Aircraft:GetDescendants()) do
if part:IsA("BasePart") or part:IsA("MeshPart") or part:IsA("UnionOperation") then
part.Material = Enum.Material.Sandstone
part.BrickColor = BrickColor.new("Dark stone grey")
end
end
end
end)
oh man i wasn’t on devfourm sorry ehm if you don’t have debounce do you still have the audio issue that it spams? Cause when i am looking at it i don’t see an issue.