|
| 09 Sep 2016 08:55 PM |
script.Parent.Touched:connect(function(hit) local Player = game.Players:GetPlayerFromCharacter(hit.Parent) if Player ~= nil then Player.PlayerGui.Coin:Play() Player.PlayerGui.ScreenGui.CoinCounter.Coins.Value = Player.PlayerGui.ScreenGui.CoinCounter.Coins.Value + 1 script.Parent:Destroy() end end)
while true do wait() script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0, 0.075, 0) end
Recently, dumb me just realized that you need a localscript to play a sound locally, not just have the sound be in the GUI. I realized that because I played my game in the Roblox Player, and the sound did not work. It did, however, work in Roblox studio. I could convert this to a LocalScript, but then would the coin dissapear on the other players side? BTW I scripted this myself, not free model. |
|
|
| Report Abuse |
|
|
| |
|
|
| 09 Sep 2016 09:04 PM |
What do I mean?
I want the sound to locally play when I collect the coin, and that requires a LocalScript, and have the coin destroy when collected, and that requires a server script! |
|
|
| Report Abuse |
|
|
|
| 09 Sep 2016 09:07 PM |
bump maybe this bump is too early
|
|
|
| Report Abuse |
|
|
|
| 09 Sep 2016 09:14 PM |
| oh. sorry have not learned this stuff yet. |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 09 Sep 2016 09:17 PM |
serverscript detects when the coin is hit. deletes it and fires a remoteevent to that player's client. client receives remoteevent and plays sound locally.
|
|
|
| Report Abuse |
|
|
|
| 09 Sep 2016 09:22 PM |
| Clone and place a local script that just plays the coin sound into the player's PlayerScripts instance. |
|
|
| Report Abuse |
|
|
|
| 09 Sep 2016 09:23 PM |
| Kodran's method is the best way to do it, I just assumed you don't have filtering enabled. |
|
|
| Report Abuse |
|
|
|
| 09 Sep 2016 09:33 PM |
| Is there a way without a remote function? I tried, but I still don't quite understand the remote function well enough to do it. |
|
|
| Report Abuse |
|
|
| |
|
|
| 09 Sep 2016 09:52 PM |
09-09-2016 07:22 PM "Clone and place a local script that just plays the coin sound into the player's PlayerScripts instance." |
|
|
| Report Abuse |
|
|
|
| 09 Sep 2016 09:55 PM |
| Oh, should of understood that better. Thanks! |
|
|
| Report Abuse |
|
|