Hi! I was wondering how I would reference audio from an array I set up. Basically, I want to be able to detect the brick (which should be named Road). Then, it detects if the player is in a seat, and if they are I want it to be able to find the Road color, then reference that sound, and play it. How would I reference that? Thanks for the help!
== Mike
` -- Code --
Asphalt1Color = 163, 162, 165
Asphalt1Sound = "http://www.roblox.com/asset/?id=1962370858"
Asphalt2Color = 91, 93, 105
Asphalt1Sound = "http://www.roblox.com/asset/?id=1962369936"
ConcreteRoad1Color = 226, 220, 188
ConcreteRoad1Sound = "http://www.roblox.com/asset/?id=1962367857"
ConcreteRoad2Color = 241, 231, 199
ConcreteRoad2Sound = "http://www.roblox.com/asset/?id=2156073955"
ConcreteBridge1Color = 211, 190, 150
ConcreteBridge1Sound = "http://www.roblox.com/asset/?id=1962368939"
ConcreteBridge2Color = 199, 172, 120
ConcreteBridge2Sound = "http://www.roblox.com/asset/?id=2156079001"
ConcreteBridge3Color = 202, 191, 163
ConcreteBridge3Sound = "http://www.roblox.com/asset/?id=2156072943"
local sounds = game.ServerStorage.RoadSounds
local player = game.Player.Character or game.Player.CharacterAdded:Wait()
for i, v in pairs (player:GetChildren()) do
if v.IsA('BasePart') then
if v.Name('Road') then
v.Touched.Connect(function()
--At this point, I'd like to ref the color and sound then play it
end
end)
end
end
end
end`
(there may be too many ends here too)
