Ternous
|
  |
| Joined: 22 Oct 2012 |
| Total Posts: 1748 |
|
|
| 19 Jan 2016 12:22 PM |
when this script is on, the sound when you hit a coin sounds for all players in the game, HOw Do I make it so only the person hitting the brick hears a sound.
local Players = game:GetService("Players") local Sound = script.Parent.Victory
local Touched = function(hit) if hit.Parent then if Players:GetPlayerFromCharacter(hit.Parent) then Sound:Play() end end end
for i,v in next, script.Parent:GetChildren() do if v:IsA("BasePart") and v.Name == "Part" then v.Touched:connect(Touched) end end
|
|
|
| Report Abuse |
|
|
|
| 19 Jan 2016 12:23 PM |
| Ternous, could you please help me? |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 19 Jan 2016 12:26 PM |
| play it client side or server side from backpack/playergui will probably also work |
|
|
| Report Abuse |
|
|
|
| 19 Jan 2016 12:26 PM |
| yeah playing from playergui works |
|
|
| Report Abuse |
|
|
Ternous
|
  |
| Joined: 22 Oct 2012 |
| Total Posts: 1748 |
|
|
| 19 Jan 2016 08:04 PM |
| What do I edit in it to make it play just for the player who hits the brick? |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 19 Jan 2016 08:05 PM |
| ...you play the sound inside the player, playergui or backpack |
|
|
| Report Abuse |
|
|
Ternous
|
  |
| Joined: 22 Oct 2012 |
| Total Posts: 1748 |
|
|
| 19 Jan 2016 08:09 PM |
so change this line
Sound:Play()
to this
Sound:Play:FindFirstChild("StarterGUI") |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 19 Jan 2016 08:10 PM |
sound.Parent = player sound:Play() |
|
|
| Report Abuse |
|
|
Ternous
|
  |
| Joined: 22 Oct 2012 |
| Total Posts: 1748 |
|
|
| 19 Jan 2016 08:11 PM |
is this correct?
local Touched = function(hit) if hit.Parent then if Players:GetPlayerFromCharacter(hit.Parent) then sound.Parent = player Sound:Play() end end end
for i,v in next, script.Parent:GetChildren() do if v:IsA("BasePart") and v.Name == "Part" then v.Touched:connect(Touched) end end |
|
|
| Report Abuse |
|
|
|
| 19 Jan 2016 08:14 PM |
| no, it's not. do you know how to script? |
|
|
| Report Abuse |
|
|
Ternous
|
  |
| Joined: 22 Oct 2012 |
| Total Posts: 1748 |
|
|
| 19 Jan 2016 08:35 PM |
| not really someone made it for me. |
|
|
| Report Abuse |
|
|
Ternous
|
  |
| Joined: 22 Oct 2012 |
| Total Posts: 1748 |
|
| |
|
Ternous
|
  |
| Joined: 22 Oct 2012 |
| Total Posts: 1748 |
|
| |
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 20 Jan 2016 01:36 AM |
If you didn't understand the previous explanations, please don't bump anymore, lol.
You need to fire the sound locally, either from the Player, or the StarterGui, or some other locally-held area.
Be curious about it, use the wiki: http://wiki.roblox.com/index.php?title=Sounds#Playing_Sound
|
|
|
| Report Abuse |
|
|