Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Won't work in localscript?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I know this script isn't the most efficient, but i'm having troubles with it. I want to click a button and make fog go to 0 and play a thump noise got that done. It just won't work in local script that makes it so it will only happen to the person that presses it. It's either a simple mistake or the whole 9 yards. Thanks for helping!

local sound = script.Parent.Sound
local sound1 = script.Parent.Thump


function playsound()
    sound:Play()
    game.Ambient.FogEnd = 0
    sound1:Play()
    wait(1)
    sound1:Play()
    wait(1)
    sound1:Play()
    wait(1)
    sound1:Play()
    wait(1)
    sound1:Play()
    wait(1)
    sound1:Play()
    wait(1)
    sound1:Play()
    wait(1)
    sound1:Play()
    wait(1)
    sound1:Play()
    wait(1)
    sound1:Play()
    wait(1)
    sound1:Play()
    wait(1)
    sound1:Play()
    wait(1)
    sound1:Play()
    wait(1)
    sound1:Play()
    wait(2)
    sound1:Play()
    wait(3)
    game.Ambient.FogEnd = 50
end

script.Parent.ClickDetector.MouseClick:connect(playsound)
0
First in line 08 you started playing the Song, Once it plays it Plays, you don't need multiple plays. woodengop 1134 — 9y
0
I know but I want multiple thumps mechasaultfreak2 10 — 9y
0
You just explained what you were using, and that is your problem; you are using a 'LocalScript', and you are attempting to use a 'LocalScript' like a 'Script'-Script, 'LocalScript''s only working within a Player's Character, or in their 'PlayerGui', they aren't supported in the Workspace itself, use a regular 'Script' instead [Server-Sided]', also lines 8-36, that many lines are not necessary, con TheeDeathCaster 2368 — 9y
0
*Consider using a 'for' loop? Also, just pointing out mistakes and errors, sorry if I sound harsh. TheeDeathCaster 2368 — 9y
0
Use a Regular Script for ClickDetector. woodengop 1134 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

ClickDetector requires a regular script.

Ad

Answer this question