|
| 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 |
|
|
|
| 20 Sep 2015 10:49 PM |
idc no more, bump
This is morash's professor -DB |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
| |
|
|
| 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
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 20 Sep 2015 10:56 PM |
| PlayerAdded might not always fire on play solo |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 20 Sep 2015 11:02 PM |
That is a little pointless.
-The [Guy] |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2015 11:03 PM |
probably
DermonDarble is celebrating |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|