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: Help me please

Previous Thread :: Next Thread 
morashsPeasant is not online. morashsPeasant
Joined: 06 Jan 2011
Total Posts: 4944
20 Sep 2015 10:44 PM
Guys I'm so sick of player added not firing, WHY IS THIS HAPPENING TO MEEEE????????????????????????????????????????????????????????????????????????????
I've spent 20 minutes literally scratching my head over something that should work and was working.. and now all of a sudden it doesn't even execute!!!!!!!!!!! Am I missing something really obvious or should I just stop give up??? Here is the code

print'hi'<--PRINTS THIS
game:GetService("Players").PlayerAdded:connect(function(player)
print("Hello player!") <--- DOES NOT PRINT THIS!!
PlayerData[player.Name] = getData(player)
remoteEvent:FireClient(player,"SaveData",PlayerData[player.Name])
end)
game:GetService("Players").PlayerRemoving:connect(function(player) --> THis one executes fine..
print'gaargh' -->PRINT print no problem here :(
local returned = parseData(player,PlayerData[player.Name]) --> errors here but its because player added isn't firing
warn'dang2'
saveData(player,returned)
PlayerData[player.Name] = nil
end)


This is morash's skrub -DB
Report Abuse
morashsPeasant is not online. morashsPeasant
Joined: 06 Jan 2011
Total Posts: 4944
20 Sep 2015 10:49 PM
idc no more, bump

This is morash's professor -DB
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
20 Sep 2015 10:51 PM
I didn't read it all but did you try it in an actual server? If you are using a feature that is available only in a real server, then it won't throw an error usually but it just won't work. (for example, httpservice)

-The [Guy]
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
20 Sep 2015 10:51 PM
You're testing online?
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
20 Sep 2015 10:52 PM
Ninja'd?

-The [Guy]
Report Abuse
morashsPeasant is not online. morashsPeasant
Joined: 06 Jan 2011
Total Posts: 4944
20 Sep 2015 10:55 PM
It works online!!
How come it doesn't work on test Solo???? I Swear it worked half an hour ago!!! Studio API Access is enabled.

This is morash's lab rat -DB
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
20 Sep 2015 10:56 PM
PlayerAdded might not always fire on play solo
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
20 Sep 2015 10:56 PM
Yeah it's a bit weird why the PlayerRemoving would fire in studio... but your issue is possibly because you were trying to save data? I can't tell, your function was not included in the code.

-The [Guy]
Report Abuse
DermonDarble is not online. DermonDarble
Joined: 04 Jun 2015
Total Posts: 2576
20 Sep 2015 11:01 PM
what if you did

local players = game:GetService("Players")

players.PlayerAdded



though that might just be me being dumb

DermonDarble is not
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
20 Sep 2015 11:02 PM
That is a little pointless.

-The [Guy]
Report Abuse
DermonDarble is not online. DermonDarble
Joined: 04 Jun 2015
Total Posts: 2576
20 Sep 2015 11:03 PM
probably

DermonDarble is celebrating
Report Abuse
morashsPeasant is not online. morashsPeasant
Joined: 06 Jan 2011
Total Posts: 4944
20 Sep 2015 11:10 PM
Is Dermon REALLY celebrating???
Guys, I think I found the problem/solution.. The reason the PlayerAdded Event wans't firing is because it hadn't actually been connected before the player joined, it was connected a couple ms later. Here is the DataStore query that was taking the little time and slowing down the PlayerAdded:connection just by a little bit:

for i,v in pairs(products) do
local itemStats = salesData:GetAsync(tostring(v))
if not itemStats then
salesData:SetAsync(tostring(v),0)
elseif itemStats then
print("Total Sales for " .. tostring(v).. " is: " .. tonumber(itemStats))
end
end

After I moved this below the :connect() it works like magic! so yeah it was just slowed down by a data store query qq

morashsPeasant is skrubbing
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