Kenpay Posted July 15, 2018 Share Posted July 15, 2018 Hi there! I'm trying to spawn player on some location when they spawn, but I don't know why doesn't work. function onJoin() outputChatBox(tostring(source)) source:spawn(-2404.00000, -598.00000, 132.64844) source:fadeCamera(true) source:setCameraTarget(source) end addEventHandler("onPlayerJoin", root, onJoin) In console i get : ERROR: [ResourceName]\[ScriptName].lua:[lineNumber]: attemp to index global 'source' ( a userdata value ) When i connect to server in chat i get : userdata: 00000097 Any ideas ? Link to comment
myonlake Posted July 15, 2018 Share Posted July 15, 2018 Make sure to add the following line to your meta.xml. <oop>true</oop> 2 Link to comment
Kenpay Posted July 15, 2018 Author Share Posted July 15, 2018 12 minutes ago, myonlake said: Make sure to add the following line to your meta.xml. <oop>true</oop> Yeah, that was the problem...I though that it is by default true. Link to comment
_Evo_ Posted July 16, 2018 Share Posted July 16, 2018 function onJoin () spawnPlayer (source, -2404.00000, -598.00000, 134.64844, 0, math.random (0,288), 0, 0) -- spawns with random skin fadeCamera (source, true) setCameraTarget (source, source) end addEventHandler("onPlayerJoin", getRootElement(), onJoin) Link to comment
Kenpay Posted July 16, 2018 Author Share Posted July 16, 2018 3 minutes ago, _Evo_ said: function onJoin () spawnPlayer (source, -2404.00000, -598.00000, 134.64844, 0, math.random (0,288), 0, 0) -- spawns with random skin fadeCamera (source, true) setCameraTarget (source, source) end addEventHandler("onPlayerJoin", getRootElement(), onJoin) 17 hours ago, myonlake said: Make sure to add the following line to your meta.xml. <oop>true</oop> That was the problem Link to comment
_Evo_ Posted July 16, 2018 Share Posted July 16, 2018 Just now, Kenpay said: That was the problem which? Link to comment
Galactix Posted July 16, 2018 Share Posted July 16, 2018 57 minutes ago, Kenpay said: <oop>true</oop> Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now