KOzeroJoin Date: 2010-05-11 Post Count: 1411 |
Why is that?
Output:bad argument #1 to 'status' (coroutine expected)
print(coroutine.status(On)) |
|
klklJoin Date: 2007-08-29 Post Count: 887 |
You need to create a coroutine first.
local newThread = coroutine.create(function() |
|
|
You need to first create a coroutine lol. |
|
HuntHelloJoin Date: 2011-01-19 Post Count: 577 |
Does on has a reference to a coroutine is it a couroutine?
Local on = coroutine.create()? |
|
KOzeroJoin Date: 2010-05-11 Post Count: 1411 |
That isn't the full script.
|
|
HuntHelloJoin Date: 2011-01-19 Post Count: 577 |
Then we can't fully help you. |
|
KOzeroJoin Date: 2010-05-11 Post Count: 1411 |
On = coroutine.wrap(function()
repeat
for e,z in pairs (v:GetChildren()) do
if z.Name =="RIndicator" then
z.BrickColor = BrickColor.new("Bright orange")
z.Transparency = 0
wait(0.4)
z.BrickColor = BrickColor.new("White")
z.Transparency = 0.7
wait(0.4)
end
end
until v.VehicleSeat.SeatWeld.Part1.Parent ~= character or v.VehicleSeat.Steer == -1 or Stop == true or v:FindFirstChild("LIndicator").BrickColor == BrickColor.new("Bright orange")
coroutine.yield()
end)
On()
--Still not the full script... |
|
klklJoin Date: 2007-08-29 Post Count: 887 |
add on.resume() |
|
HuntHelloJoin Date: 2011-01-19 Post Count: 577 |
Call on() with coroutine.resume |
|
klklJoin Date: 2007-08-29 Post Count: 887 |
OH lol Hunt's way is correct. I haven't used coroutines in a long time ;) |
|
KOzeroJoin Date: 2010-05-11 Post Count: 1411 |
What's the difference between coroutine.resume(), coroutine.warp() and which is the most efficient. |
|
HuntHelloJoin Date: 2011-01-19 Post Count: 577 |
Him resume runs the coroutine, wrap creates it |
|
HuntHelloJoin Date: 2011-01-19 Post Count: 577 |
^wrap creates it, resume runs it |
|
HuntHelloJoin Date: 2011-01-19 Post Count: 577 |
There is no coroutine.warp |
|
|
I use coroutine.wrap to ignore a few wait()'s in some of my scripts. |
|
KOzeroJoin Date: 2010-05-11 Post Count: 1411 |
Still it stops at until and the script doesn't run again.
local Mouse = game:GetService("Players").LocalPlayer:GetMouse()
local Player = game:GetService("Players").LocalPlayer
local KeyPressed = true
local Stop = false
Player.CharacterAdded:connect(function(character)
Player.Character.Humanoid.Seated:connect(function()
Mouse.KeyDown:connect(function(Key)
if Key == "e" and KeyPressed == true then
KeyPressed = false
for i,v in pairs (Workspace:GetChildren()) do
if v.Name == "Car" and v.VehicleSeat.SeatWeld.Part1.Parent == character then
On = coroutine.create(function()
repeat
for e,z in pairs (v:GetChildren()) do
if z.Name =="RIndicator" then
z.BrickColor = BrickColor.new("Bright orange")
z.Transparency = 0
wait(0.4)
z.BrickColor = BrickColor.new("White")
z.Transparency = 0.7
wait(0.4)
end
end
until v.VehicleSeat.SeatWeld.Part1.Parent ~= character or v.VehicleSeat.Steer == -1 or Stop == true or v:FindFirstChild("LIndicator").BrickColor == BrickColor.new("Bright orange")
end)
coroutine.resume(On)
elseif Key == "e" and KeyPressed == false then
if v.Name == "Car" then
if coroutine.status(On) == "running" then
Stop = true
repeat wait() until coroutine.status(On) == "dead"
Stop = false
KeyPressed = true
end
end
end
end
end
end)
end)
end)
|
|
KOzeroJoin Date: 2010-05-11 Post Count: 1411 |
No-one has an idea how to fix this right? |
|
KOzeroJoin Date: 2010-05-11 Post Count: 1411 |
Bump |
|
HuntHelloJoin Date: 2011-01-19 Post Count: 577 |
Any errors! |
|
KOzeroJoin Date: 2010-05-11 Post Count: 1411 |
No errors, the function doesn't trigger the 2nd time and it stops in the repeat stack. |
|