Kenpay Posted July 15, 2018 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 ?
myonlake Posted July 15, 2018 Posted July 15, 2018 Make sure to add the following line to your meta.xml. <oop>true</oop> 2 If I helped you, please click the like button on the right Thanks!
Kenpay Posted July 15, 2018 Author 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.
_Evo_ Posted July 16, 2018 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)
Kenpay Posted July 16, 2018 Author 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
Galactix Posted July 16, 2018 Posted July 16, 2018 57 minutes ago, Kenpay said: <oop>true</oop> If I helped you, make sure you click the reaction button on the right to support me! It will grant me more visibility and will help me to help others!If you have any kind of request or subject you would like to discuss about with me, don't hesitate to send me a private message about it!
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