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: Script Help

Previous Thread :: Next Thread 
Daraked is not online. Daraked
Joined: 10 Jul 2015
Total Posts: 461
15 Jul 2015 06:46 PM
I tried making the zooming in and out sounds work, but when I tried it, it doesnt work. Whats wrong with the zooming in and out part?

function waitForChild(parent, childName)
local child = parent:findFirstChild(childName)
if child then return child end
while true do
child = parent.ChildAdded:wait()
if child.Name==childName then return child end
end
end

function newSound(id)
local sound = Instance.new("Sound")
sound.SoundId = id
sound.archivable = false
sound.Parent = script.Parent.Head
return sound
end

-- declarations

local sDied = newSound("rbxasset://sounds/uuhhh.wav")
local sOuch = newSound("rbxasset://sounds/splat.wav")
local sFallingDown = newSound("rbxasset://sounds/splat.wav")
local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
local sGettingUp = newSound("rbxasset://sounds/hit.wav")
local sJumping = newSound("rbxasset://sounds/swoosh.wav")
local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
local sZoomingIn = newSound("rbxasset://sounds/SWITCH3.wav")
local sZoomingOut = newSound("rbxasset://sounds/SWITCH3.wav")
sRunning.Looped = true

local Figure = script.Parent
local Head = waitForChild(Figure, "Head")
local Humanoid = waitForChild(Figure, "Humanoid")

-- functions

function onDied()
sDied:Play()
sOuch:Play()
end

function onState(state, sound)
if state then
sound:Play()
else
sound:Pause()
end
end

function onRunning(speed)
if speed>0 then
sRunning:Play()
else
sRunning:Pause()
end
end

function onZoomingIn(speed)
if speed>0 then
sZoomingIn:Play()
else
sZoomingIn:Pause()
end
end

function onZoomingOut(speed)
if speed>0 then
sZoomingOut:Play()
else
sZoomingOut:Pause()
end
end

-- connect up

Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
Humanoid.ZoomingIn:connect(function(state) onState(state, sZoomingIn) end)
Humanoid.ZoomingOut:connect(function(state) onState(state, sZoomingOut) end)
Report Abuse
Daraked is not online. Daraked
Joined: 10 Jul 2015
Total Posts: 461
15 Jul 2015 06:50 PM
bump
Report Abuse
redlo43 is not online. redlo43
Joined: 16 Feb 2011
Total Posts: 4722
15 Jul 2015 06:58 PM
Zoomingin is not an event ok!!!!!!!
Report Abuse
Daraked is not online. Daraked
Joined: 10 Jul 2015
Total Posts: 461
15 Jul 2015 07:01 PM
Dont be mean, I just need help.

The other sounds work but not the specific one.
Report Abuse
redlo43 is not online. redlo43
Joined: 16 Feb 2011
Total Posts: 4722
15 Jul 2015 07:04 PM
I'm not being mean!!!! Zoomingin and zoomingout are not events!!!!!!!!!!!!! Ok!!!
Report Abuse
Daraked is not online. Daraked
Joined: 10 Jul 2015
Total Posts: 461
15 Jul 2015 07:06 PM
Then what should I change?

Just post the script below and Ill replace it with it.
Report Abuse
Scyber is not online. Scyber
Joined: 21 Jun 2011
Total Posts: 350
15 Jul 2015 07:09 PM
Use events WheelForward and WheelBackward. You'll need to get the player's mouse though
Report Abuse
Daraked is not online. Daraked
Joined: 10 Jul 2015
Total Posts: 461
15 Jul 2015 07:12 PM
Thanks but how?
Report Abuse
Scyber is not online. Scyber
Joined: 21 Jun 2011
Total Posts: 350
15 Jul 2015 07:18 PM
Put this code into a LocalScript and then put the LocalScript in StarterPlayerScripts in the StarterPlayer folder.



local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

function newSound(id)
local sound = Instance.new("Sound")
sound.SoundId = id
sound.Parent = script
return sound
end

local sZoomingIn = newSound("rbxasset://sounds/SWITCH3.wav")
local sZoomingOut = newSound("rbxasset://sounds/SWITCH3.wav")

function onZoomingIn()
sZoomingIn:Play()
end

function onZoomingOut()
sZoomingOut:Play()
end

Mouse.WheelForward:connect(function(state) onZoomingIn() end)
Mouse.WheelBackward:connect(function(state) onZoomingOut() end)
Report Abuse
Daraked is not online. Daraked
Joined: 10 Jul 2015
Total Posts: 461
15 Jul 2015 07:24 PM
Didnt work
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