so basically i just want a sound to play when i click a part. this is what script i have but it wont work. the script is located inside a clickdetector inside a part.
Play() does not have any arguments for it, so just get rid of the numbers in the () and you should be good. If you’re trying to give the sound an id, change it’s SoundId property.
It looks like you already have a sound in the part, but yes, a sound should be in it, and its SoundId property should be the id of the sound you want to play.
okay, i put this in a script, put the script inside a part and changed the your part location to workspace. so does the script and sound need to be inside the clickdetector or not
The Script can be anywhere you want as long as the locations are correct.
I made an example script for you that will automatically create a Part and setup everything for you:
local Part = Instance.new("Part", workspace)
Part.Anchored = true
Part.Position = Vector3.new(0, 0, 0)
-- Creating a Part in workspace, anchoring it and setting it's position to 0, 0, 0
local Sound = Instance.new("Sound", Part)
Sound.SoundId = "rbxassetid://156286438"
-- Creating a sound in Part and setting it's SoundId.
local ClickDetector = Instance.new("ClickDetector", Part)
-- Creating a ClickDetector in Part.
ClickDetector.MouseClick:Connect(function()
Sound:Play()
end)
-- When MouseClick is fired, the Sound will be played.
well yeah but i mean, instead of creating a new part i already made a button on a special place, so what script do i need to put in there so that part makes the sound?