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: Coroutine error... without coroutines...?

Previous Thread :: Next Thread 
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
16 Jun 2016 11:47 PM
Basically, The game throws this error after the player has died and it tries to run the functions a second time.



23:16:52.299 - cannot resume non-suspended coroutine
23:16:52.299 - Script 'ServerScriptService.Server Handler', Line 12 - field ?
23:16:52.300 - Script 'ServerScriptService.Server Handler', Line 41
23:16:52.300 - Stack End
23:16:52.300 - cannot resume non-suspended coroutine
23:16:52.300 - Script 'Players.Player1.PlayerScripts.Framework', Line 24 - method fetch
23:16:52.301 - Script 'Players.Player1.PlayerScripts.Framework', Line 240
23:16:52.301 - Stack End

This is how the server handles functions:

function remoteFunction.OnServerInvoke(client,data)
--print('Attempting to index Server Function '..data['FunctionType'])
if data and data['FunctionType'] and functions[data['FunctionType']] then
return functions[data['FunctionType']](client,data)
elseif data and not data['FunctionType'] then
error('No Parameter "FunctionType" was provided. You might be using code from the Outdated Redux version.')
elseif data then
error('Could not index FunctionType '..data['FunctionType']..'. Perhaps there was a typo in the function name?')
else
return false
end
end


and this is how the client sends requests:

local network = {}

function network:send(data)
print('okay2')
remoteEvent:FireServer(data)
end

function network:fetch(data)
return remoteFunction:InvokeServer(data)
end

local neck = network:fetch({['FunctionType'] = 'createNeck'})


the power of the meme ( ͡° ͜ʖ ͡°)
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
17 Jun 2016 12:08 AM
Maybe you can't yield in a callback for RemoteFunctions, but not sure about that since I never tried yielding in that case
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jun 2016 12:08 AM
wot do


the power of the meme ( ͡° ͜ʖ ͡°)
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
17 Jun 2016 12:11 AM
Are you yielding in that specific function?
'functions[data['FunctionType']](client,data)'
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jun 2016 12:15 AM
here are all my functions


functions.LoadCharacter = function(Client,data)
Client:LoadCharacter()
end

functions.SpawnCharacter = function(Client,data)
local spawnLoc = math.random(1,#game.Workspace.Spawns:GetChildren())
Client:LoadCharacter()
Client.Character.HumanoidRootPart.CFrame = game.Workspace.Spawns['Spawn'..spawnLoc].CFrame
end

functions.createNeck = function(Client,data)
print('run')
local neck = Instance.new("Motor6D", Client.Character:WaitForChild('Torso'))
neck.Part0 = Client.Character.Torso
neck.Part1 = Client.Character.Head
neck.C0 = CFrame.new(0, 1.5, 0)

if Client.Character.Torso.Neck then
Client.Character.Torso.Neck:Destroy()
neck.Name = "Neck"
end
return neck
end


the power of the meme ( ͡° ͜ʖ ͡°)
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
17 Jun 2016 12:16 AM
Oh I just realized you're calling error in the callback.
That's not a good idea since the client expects the function to return, but using error might prevent that from happening.
Try replacing the errors with warns or something and see if you still get that
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jun 2016 12:18 AM
Haven't had any of the error()'s be called yet. And I changed it so it doesn't use them anymore. Same error.


the power of the meme ( ͡° ͜ʖ ͡°)
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jun 2016 12:32 AM
kms


the power of the meme ( ͡° ͜ʖ ͡°)
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jun 2016 12:50 AM
b


the power of the meme ( ͡° ͜ʖ ͡°)
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jun 2016 01:12 AM
please :c


the power of the meme ( ͡° ͜ʖ ͡°)
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jun 2016 01:56 AM
character auto loads is disabled

functions.SpawnCharacter = function(Client,data)
local spawnLoc = math.random(1,#game.Workspace.Spawns:GetChildren())
Client:LoadCharacter()
Client.Character.HumanoidRootPart.CFrame = game.Workspace.Spawns['Spawn'..spawnLoc].CFrame
end


^is run when the player deploys Via the RemoteEvent

V is run whenever the CharacterAdded event is fired on the player via the RemoteFunction

functions.createNeck = function(Client,data)
print('run')
local neck = Instance.new("Motor6D", Client.Character:WaitForChild('Torso'))
neck.Part0 = Client.Character.Torso
neck.Part1 = Client.Character.Head
neck.C0 = CFrame.new(0, 1.5, 0)

if Client.Character.Torso.Neck then
Client.Character.Torso.Neck:Destroy()
neck.Name = "Neck"
end
return neck
end



the power of the meme ( ͡° ͜ʖ ͡°)
Report Abuse
ImperialOutcast is not online. ImperialOutcast
Joined: 24 Nov 2009
Total Posts: 12054
17 Jun 2016 02:28 AM
Not on my laptop... Cri.
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jun 2016 03:13 AM
b


the power of the meme ( ͡° ͜ʖ ͡°)
Report Abuse
BanTech is not online. BanTech
Joined: 31 Dec 2015
Total Posts: 886
17 Jun 2016 03:47 AM
This happens when you invoke the remote function (or bindable) before it has returned. Usually this is because you've put the invoking inside of an event handler, so it has the opportunity to fire twice before it has completed.

Could be that the CharacterAdded event fires twice. I've heard rumours of this, where it fires once with a nil character and again with a real character. Try investigating around that.
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jun 2016 03:58 AM
Nope, it's not firing twice.


the power of the meme ( ͡° ͜ʖ ͡°)
Report Abuse
ImperialOutcast is not online. ImperialOutcast
Joined: 24 Nov 2009
Total Posts: 12054
17 Jun 2016 03:59 AM
Let me look at it tomorrow kk
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jun 2016 05:41 AM
b


the power of the meme ( ͡° ͜ʖ ͡°)
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
17 Jun 2016 06:35 AM
It's because Roblox's task scheduler tries to resume the coroutine, even though it has errored out already. You can get a similar effect if you pcall a function where you yield inside a C callback.
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jun 2016 06:37 AM
uwot


the power of the meme ( ͡° ͜ʖ ͡°)
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jun 2016 06:37 AM
I never had any of the Error's fire though


the power of the meme ( ͡° ͜ʖ ͡°)
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
17 Jun 2016 06:44 AM
print(pcall(table.sort,{3,6},wait))

You'll probably end up with it telling you that it couldn't do stuff after it has finished attempting to yield.
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jun 2016 06:57 AM
I don't see how that helps

I deleted all the error stuff as it's not necessary anyways, but i still can't fix the problem


the power of the meme ( ͡° ͜ʖ ͡°)
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jun 2016 07:50 AM
omfg


#code io.write('( ͡° ͜ʖ ͡°)')
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