Slastraf Posted September 14, 2015 Share Posted September 14, 2015 function Script:UpdatePhysics() Script.H=false Script.count = 100 ... if H == true then self.Stop() end end function Script:Stop()--in H=true local t = Time:GetCurrent() local bb = 500 if self.count[insert or modify code here] then if t == t+bb then bb=bb+t49 count = count -0.01 self.source:SetVolume(count) end else self:Disable() H=false end end This code is a modified noise script. This code doesnt work, I have a trigger at my map that uses Stop() with the flowgraph . So when I touch the trigger with the fpsplayer the pivot with this script attached the program crashes and says attemt to index local self ( a null value ) at the line marked. Is there an easyer way of just doing this without the timer that i didnt knew yet or does someone got a fix for this ? Quote Link to comment Share on other sites More sharing options...
BluHornet Posted September 15, 2015 Share Posted September 15, 2015 well there is a problem that you call stop once then use the stop function for the count. Unless you are calling stop more than once you will never "count". if you do call stop more than once you are setting local bb every count. try something like this. add a Script.stop to the variables at the top. change the stop function to this function Script:Stop() --in self.stop = true end then in UpdateWorld add something like if self.stop == true and self.volume > 0 then self.volume = self.volume -1 self.source:SetVolume(self.volume) end so in this example the stop only changes a bool that triggers the UpdateWorld passes to start counting and lower the volume. UpdateWorld is looped constantly so this will now count as opposed to the stop function which only runs through once when called. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.