generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Audios acting weird

Previous Thread :: Next Thread 
Fangous is not online. 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 is not online. 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 is not online. 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
wonderful72pike is not online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
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
wonderful72pike is not online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
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 is not online. 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 is not online. 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
wonderful72pike is not online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
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 is not online. 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
wonderful72pike is not online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
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 is not online. KLGA
Joined: 19 Apr 2014
Total Posts: 2571
09 Jun 2016 02:13 PM
make sure it's not playonremove
Report Abuse
Fangous is not online. 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 is not online. Fangous
Joined: 03 Jul 2010
Total Posts: 4448
09 Jun 2016 02:19 PM
playonremove isnt on
Report Abuse
Fangous is not online. Fangous
Joined: 03 Jul 2010
Total Posts: 4448
09 Jun 2016 02:31 PM
pls
Report Abuse
Fangous is not online. Fangous
Joined: 03 Jul 2010
Total Posts: 4448
09 Jun 2016 02:44 PM
bump
Report Abuse
Fangous is not online. 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
killerbot29003 is not online. killerbot29003
Joined: 04 Oct 2014
Total Posts: 3054
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image