Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
|
| 09 Jun 2016 01:55 PM |
This script wont override the current audio. Instead, it just creates the new audio and disregards the audio named "xantaria" that it is supposed to delete.
Note: This is in a regular script in an on touched function, and it does work in studio, not in the actual game. Also PlayOnRemoved is set to false.
local plyr = game.Players:FindFirstChild(hit.Parent.Name)
if plyr.PlayerGui.main:FindFirstChild("xantaria") then plyr.PlayerGui.main.xantaria:Stop() plyr.PlayerGui.main.xantaria:Destroy() print("deleted audio") end wait() local sound = Instance.new("Sound") sound.Parent = plyr.PlayerGui.main sound.Name = "tavern" sound.SoundId = "rbxassetid://183244291" sound:Play() |
|
|
| Report Abuse |
|
|
KLGA
|
  |
| Joined: 19 Apr 2014 |
| Total Posts: 2571 |
|
|
| 09 Jun 2016 01:57 PM |
just pointing something out, probably not the issue, but there's a more efficient way of getting the player:
game.Players:GetPlayerFromCharacter(hit.Parent)
Also the only thing I can think of here is xantaria doesn't exist. Make sure your directory is correct |
|
|
| Report Abuse |
|
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
|
| 09 Jun 2016 01:58 PM |
xantaria does exist and there is no error in the output instead it makes a new audio and they both play at the same time
works is studio but not in the actual game :/ |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2016 01:58 PM |
| If it's disregarding it then that means the condition statement is false and xantaria isn't inside of main. |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2016 02:00 PM |
"works in studio but not in the actual game"
Disregard my previous post, this right here is the key. This can cause several issues. Your issue is most likely a...
- Loading issue (xantaria doesn't exist when this script is being run) - Access issue (this script doesn't have access to the sound)
This is because in Studio the entire game is client-side and these two problems aren't an issue. |
|
|
| Report Abuse |
|
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
|
| 09 Jun 2016 02:01 PM |
This is the script that creates "xantaria" which is in a local script
if game.Players.LocalPlayer.PlayerGui.main:FindFirstChild("xantaria") ~= true then script.Parent.Parent.Parent.Parent.Parent.tavern:Destroy() local sound = Instance.new("Sound") sound.Parent = game.Players.LocalPlayer.PlayerGui.main sound.Name = "xantaria" sound.SoundId = "rbxassetid://164086130" sound:Play() end |
|
|
| Report Abuse |
|
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
|
| 09 Jun 2016 02:02 PM |
| why would the script not have access to it? |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2016 02:05 PM |
| What can be seen on the server vs. what can be seen on the client. Sometimes server scripts don't have access to local stuff like things in the PlayerGui. I personally don't believe this is the issue but it's always something to look at. |
|
|
| Report Abuse |
|
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
|
| 09 Jun 2016 02:10 PM |
ok what
it printed "deleted audio" but the audio didnt stop playingggg |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2016 02:12 PM |
| Check if you have the "PlayOnRemove" box checked off. If not then the audio isn't properly stopping and you are having a really weird time '~' |
|
|
| Report Abuse |
|
|
KLGA
|
  |
| Joined: 19 Apr 2014 |
| Total Posts: 2571 |
|
|
| 09 Jun 2016 02:13 PM |
| make sure it's not playonremove |
|
|
| Report Abuse |
|
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
|
| 09 Jun 2016 02:13 PM |
is playonremove on by default? lol this is reallyyyyyy annoying |
|
|
| Report Abuse |
|
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
| |
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
| |
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
| |
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
|
| 09 Jun 2016 03:08 PM |
only fix that worked was moving to a local script and calling it with a button click
|
|
|
| Report Abuse |
|
|
|
| 09 Jun 2016 03:48 PM |
local plyr = game.Players:FindFirstChild(hit.Parent.Name) local w = plyr.PlayerGui:WaitForChild("main") local xantaria = w:WaitForChild("xantaria")
if w and xantaria then print("Hello world!") xantaria:Stop() xantaria:Destroy() print("deleted audio") end local sound = Instance.new("Sound") sound.Parent = w sound.Name = "tavern" sound.SoundId = "rbxassetid://183244291" sound:Play()
Try and see if that works if both the main and xantaria is there, it should print "Hello world" and "deleted audio".
This siggy is copyrighted © |
|
|
| Report Abuse |
|
|