of     2   
chevron_rightchevron_rightchevron_right

kisamebeast
#11839567Monday, July 27, 2009 4:22 PM GMT

Yeah with delay, didn't the script delay until the functions was run? Would it go like: delay(function() script.Parent.Enabled.Changed:connect(function(prop) --blah Or if theres an easier way to delay a script until something is changed, plz post that. Er another thing, please post ASAP, I need this answered very soon.
MicroUser
#11839623Monday, July 27, 2009 4:24 PM GMT

[ Content Deleted ]
sncplay42
#11839678Monday, July 27, 2009 4:25 PM GMT

delay(time, function) calls function after time seconds, without pausing the current thread.
JORDOFF
#11839688Monday, July 27, 2009 4:25 PM GMT

just delay = script.Parent.BoolValue while delay == true do wait(1) end --rest of script here
MicroUser
#11839772Monday, July 27, 2009 4:27 PM GMT

[ Content Deleted ]
JORDOFF
#11839835Monday, July 27, 2009 4:28 PM GMT

hey it whoud stop the script till script.Parent.BoolValue = false right
MicroUser
#11839880Monday, July 27, 2009 4:29 PM GMT

[ Content Deleted ]
JORDOFF
#11839899Monday, July 27, 2009 4:29 PM GMT

never mind that whould never stop it needs to be delay = script.Parent.BoolValue while delay == true do delay = script.Parent.BoolValue --if you don't have this delay won't update wait(1) end --rest of script here
JORDOFF
#11839927Monday, July 27, 2009 4:30 PM GMT

@MicroUser right i see what your saying...
MicroUser
#11839935Monday, July 27, 2009 4:30 PM GMT

[ Content Deleted ]
JORDOFF
#11839978Monday, July 27, 2009 4:31 PM GMT

@MicroUser ok...
kisamebeast
#11840109Monday, July 27, 2009 4:33 PM GMT

Argh, I forgot about coroutines.... So say I had this: Text = {Blah, blah, blah} Cor = coroutine.create(function() while true do --Just a Rough little thing wait(8) for i,v in ipairs(Text) do coroutine.yield(v) end end while true do if condition then wait() else Somehint.Text = coroutine.resume(Cor) --Something like that? end end Something like that?
MicroUser
#11840201Monday, July 27, 2009 4:35 PM GMT

[ Content Deleted ]
kisamebeast
#11840239Monday, July 27, 2009 4:36 PM GMT

Oh now I see that lol Ill try it
kisamebeast
#11840713Monday, July 27, 2009 4:47 PM GMT

This is the actual script,Do you think it will cause any running errors? game.Players.PlayerAdded:connect(function(playa) local Text = {"Welcome to The Hardest/Longest Obby in Roblox "..playa.Name.." !", "Theres are currently "..#game.Teams:GetChildren().." Courses in this game", "Pay attention the the small, Red balls with the excalmation point decals in the game", "They might be helpful to you"} local h = Instance.new("Hint") h.Parent = playa h.Name = "Hint" h.Text = "" local Cor = coroutine.create(function() local pos = 0 while true do if pos == #Text then pos = 0 end pos = pos + 1 wait(8) playa.Hint.Text = Text[pos] coroutine.yield() end end) function Resume() wait() playa.Hint.Text = coroutine.resume(Cor) end function WaitUntil() while playa.Enabled do wait() end end while true do if playa.Enabled then WaitUntil() else Resume() end end end)
MicroUser
#11841232Monday, July 27, 2009 4:57 PM GMT

[ Content Deleted ]
kisamebeast
#11841774Monday, July 27, 2009 5:07 PM GMT

Not exactly. Normally when the player enters, the text in the table would be cycled through and displayed in the players Hint every 8 second. But I encountered that ni some cases, I need that cycle to be paused until a condition is passed. Thats what Im gunning for
MicroUser
#11842289Monday, July 27, 2009 5:18 PM GMT

[ Content Deleted ]
cupcakescankill
#11842624Monday, July 27, 2009 5:24 PM GMT

delay(time, function) as in delay(3, function() print("This message was delayed 3 seconds.") end)
LPGhatguy
Forum Moderator
#11847880Monday, July 27, 2009 6:53 PM GMT

I create the coroutine and run it in the same function. For example: coroutine.resume(coroutine.create(function() --Do my stuff here. end))
MicroUser
#11848843Monday, July 27, 2009 7:10 PM GMT

[ Content Deleted ]
skullorz
#11855281Monday, July 27, 2009 9:08 PM GMT

I think delay()s might be useful in my broken bit of code. I'm trying to make it so if the 'flag' is in the character, the code stops. x=0 function onFlagChanged(property, flag, set) if property=="Parent" then repeat if flag.Parent.className == "Backpack" then return end wait(1) x=x+1 print(x) until x==6 x=0 flag:Remove() --Returns the flag.. end end And yes, there is a connection. If the flag hasn't been taken in any of those six seconds, return it. What it does : I dropped the flag, picked it up. 5 seconds later it returns itself. Can you fix it? I tried Scripting Helpers, and no one posts.
zac352
#11857511Monday, July 27, 2009 9:43 PM GMT

[ Content Deleted ]
mattchewy
#11859225Monday, July 27, 2009 10:11 PM GMT

function FUNCTION(a,b,c) print(a,b,c) end assert(coroutine.resume(coroutine.create(FUNCTION),1,2,3))
kisamebeast
#11865218Tuesday, July 28, 2009 12:00 AM GMT

Lol no duh Matt, I believe even a novice scripter knows howto use coroutines. Anyways, it works, and it incorporates somehow metatables, the delay function, and coroutines :D

    of     2   
chevron_rightchevron_rightchevron_right