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: Uhm.. Is this right?

Previous Thread :: Next Thread 
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
13 Dec 2014 05:00 PM
local model = script.Parent -- Ignore this, doesn't need fixing.

local function steppedOn(part)
local parent = part.Parent
if game.Players:GetPlayerFromCharacter(parent) then
game.Workspace.Lift.Mover:Destroy() -- Ignore this, doesn't need fixing.
local sound = Instance.new("Sound",parent)
sound.SoundId = "http://www.roblox.com/asset/?id=189701469"
sound.Volume = 1
sound.TimePosition = 54
sound:Play()
end
end

model.Touched:connect(steppedOn)

Ignore the code where I have put "-- Ignore this, doesn't need fixing."

And about the sound, what I'm trying to do is to make it so that the LocalPlayer can only hear it, and not a global sound.
Report Abuse
oscar9999991 is not online. oscar9999991
Joined: 15 Nov 2009
Total Posts: 11373
13 Dec 2014 05:02 PM
local model = script.Parent -- Ignore this, doesn't need fixing.

local function steppedOn(part)
local parent = part.Parent
local player = game.Players:GetPlayerFromCharacter(parent)
if player then
game.Workspace.Lift.Mover:Destroy() -- Ignore this, doesn't need fixing.
local sound = Instance.new("Sound",player)
sound.SoundId = "rbxassetid://189701469"
sound.Volume = 1
sound.TimePosition = 54
sound:Play()
end
end

model.Touched:connect(steppedOn)

Should work
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
13 Dec 2014 05:05 PM
The sound plays, I'm just trying to make it so the LocalPlayer hears the sound, not everyone in the server..


#DurstIlluminati (R$: R$37,776) (RAP: 572,058)
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
13 Dec 2014 05:11 PM
b


#DurstIlluminati (R$: R$37,945) (RAP: 572,058)
Report Abuse
parkiet3 is not online. parkiet3
Joined: 16 Jul 2011
Total Posts: 832
13 Dec 2014 05:13 PM
Parent it to the currentcamera
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
13 Dec 2014 05:14 PM
Thanks.


#DurstIlluminati (R$: R$38,014) (RAP: 572,058)
Report Abuse
parkiet3 is not online. parkiet3
Joined: 16 Jul 2011
Total Posts: 832
13 Dec 2014 05:18 PM
local model = script.Parent -- Ignore this, doesn't need fixing.

local function steppedOn(part)
local parent = part.Parent

if game.Players:GetPlayerFromCharacter(parent) then
game.Workspace.Lift.Mover:Destroy() -- Ignore this, doesn't need fixing.
script.LocalScript:Clone().Parent=parent
end
end

model.Touched:connect(steppedOn)

in a localscript inside that script do:

local sound = Instance.new("Sound",game.Workspace.CurrentCamera)
sound.SoundId = "http://www.roblox.com/asset/?id=189701469"
sound.Volume = 1
sound.TimePosition = 54
sound:Play()
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
13 Dec 2014 05:19 PM
Helps, as I was wondering how the CurrentCamera works, or where it was. :\


#DurstIlluminati (R$: R$38,207) (RAP: 572,058)
Report Abuse
parkiet3 is not online. parkiet3
Joined: 16 Jul 2011
Total Posts: 832
13 Dec 2014 05:20 PM
Haha, currentcamera can only be accessed from localscripts
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
13 Dec 2014 05:34 PM
Sound doesn't play.. Odd..


#DurstIlluminati (R$: R$38,342) (RAP: 572,058)
Report Abuse
parkiet3 is not online. parkiet3
Joined: 16 Jul 2011
Total Posts: 832
13 Dec 2014 05:35 PM
Hmm, rather google it
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
13 Dec 2014 05:36 PM
That script you gave me, doesn't play the sound.
It's got the sound there, but hasn't been added to the CurrentCamera..


#DurstIlluminati (R$: R$38,349) (RAP: 572,058)
Report Abuse
shred1894 is not online. shred1894
Joined: 30 Aug 2009
Total Posts: 6515
13 Dec 2014 05:45 PM
Camera is having issues or something, parent the sound to PlayerGui.
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
13 Dec 2014 05:47 PM
Explain "script.LocalScript:Clone().Parent=parent" for me?


#DurstIlluminati (R$: R$38,846) (RAP: 572,058)
Report Abuse
shred1894 is not online. shred1894
Joined: 30 Aug 2009
Total Posts: 6515
13 Dec 2014 05:48 PM
local model = script.Parent -- Ignore this, doesn't need fixing.

local function steppedOn(part)
local parent = part.Parent

if game.Players:GetPlayerFromCharacter(parent) then
game.Workspace.Lift.Mover:Destroy() -- Ignore this, doesn't need fixing.
script.LocalScript:Clone().Parent=parent
end
end

model.Touched:connect(steppedOn)

in a localscript inside that script do:

local sound = Instance.new("Sound",game.Players.LocalPlayer.PlayerGui)
sound.SoundId = "http://www.roblox.com/asset/?id=189701469"
sound.Volume = 1
sound.TimePosition = 54
sound:Play()
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
13 Dec 2014 05:49 PM
dood, explain "script.LocalScript:Clone().Parent=parent"


#DurstIlluminati (R$: R$38,915) (RAP: 572,058)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
13 Dec 2014 05:49 PM
He clones something inside the script called "LocalScript", which returns the clone and sets the Parent property to whatever "parent" equals.
Report Abuse
parkiet3 is not online. parkiet3
Joined: 16 Jul 2011
Total Posts: 832
13 Dec 2014 05:50 PM
Slice it in pieces
local myscript = script.localscript:Clone -- clone the localscript
myscript.Parent = parent -- this is the player, so i cloned a script to the player
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
13 Dec 2014 05:50 PM
Oh, that helps. Thanks! :D


#DurstIlluminati (R$: R$38,950) (RAP: 572,058)
Report Abuse
SLY3 is not online. SLY3
Joined: 10 Jul 2008
Total Posts: 1700
13 Dec 2014 05:53 PM
Yes, pretty much all you have to do to play the sound locally, is put a LocalScript in StarterGui, then a sound inside that script, then this as the code:

--
wait(5) -- to avoid any glitches
script.Sound:Play()
--
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
13 Dec 2014 05:55 PM
A'ight, I got it to work. Thanks mate.


#DurstIlluminati (R$: R$38,957) (RAP: 572,058)
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