okay, I need help. How do i get a part to play a sound when another part/keycard hits the part that is needed to play a sound. to play the sound ive tried so many things but i don't know how to script? :( (it maybe a little tricky to read but im not English or american im from denmark so not the best you know)
Hi there! Here's a script to put in your part that is touched by a keycard:
cooldown = 0 script.Parent.Touched:Connect(function(hit) if hit.Parent.Name == "Keycard" and cooldown == 0 then cooldown = 1 game.workspace:FindFirstChild("Part").Sound:Play() wait(game.workspace:FindFirstChild("Part").Sound.TimeLength) cooldown = 0 end end)
This is assuming that the part that plays the sound is in the workspace. Make sure that the script to put in your part that is touched by the keycard is a regular script, and not a local script, otherwise it will not work. Let me know if you have any other questions! :D
Closed as Not Constructive by User#19524
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?