It could work but its hard, thats not what i was searching for,
Now what you sent is good, but when the bus itself touches it, it makes the sound,
I need it to be a TextGUI that is inside my bus when that touches it with the text inside the GUI saying “…”, then it makes the sound.
local WokrspaceService = game:GetService("Workspace")
local Sound = WorkspaceService.Sound
script.Parent.Touched:Connect(function(touch)
if WorkspaceService.Bus.TextGui.Frame.TextLable.Text = "..." and touch then
Sound:Play()
end
end)
local WorkspaceService = game:GetService("Workspace")
local Sound = WorkspaceService.Sound
WorkspaceService.PartNeedToTouch.Touched:Connect(function(touch)
if script.Parent.Gui.Text.Text == "..." and touch.Name == "PartThatNeedToTouchWithAnotherPart" then
Sound:Play()
end
end)
bro why you changed text to “Szerelore var”? You sayed when text will be … and part touch another part then it play sound and i edited script again, it is better to use GetService() instead workspace i can test it now.I edited script again now it must work correct. Yes it work but here is better way because when it touch again sound will play again and it will be chaos because the same sound will play in one time.But idk how to make distance for sound.Here is code with better way:
local WorkspaceService = game:GetService("Workspace")
local Sound = WorkspaceService.Sound
local CanTouch = true
function touchedPart(touch)
if CanTouch == true then
if script.Parent.Gui.Text.Text == "..." and touch.Name == "PartThatNeedToTouchWithAnotherPart" then
Sound:Play()
CanTouch = false
end
end
end
function SoundEnded()
CanTouch = true
end
WorkspaceService.PartNeedToTouch.Touched:Connect(touchedPart)
Sound.Ended:Connect(SoundEnded)
Can you show where is sound in explorer and parts that will touch in explorer too?
Video how it works(sorry for bad quality and the video is a little behind the sound):
In this video you can see this work only when sound ended and when text is …