bloberous
|
  |
| Joined: 07 Jun 2009 |
| Total Posts: 299 |
|
|
| 04 Aug 2016 07:34 AM |
So I've been using this:
blahblah..PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) -- do stuff end) end)
This works fine in solo, even when respawning.
However when played on the server, what I've noticed is that it only works whenever the player first enters, but not when it respawns? |
|
|
| Report Abuse |
|
|
|
| 04 Aug 2016 07:38 AM |
| That happened to me, and I just made a while true do loop. I guess you could reconnect the event every time the character is added again? |
|
|
| Report Abuse |
|
|
bloberous
|
  |
| Joined: 07 Jun 2009 |
| Total Posts: 299 |
|
|
| 04 Aug 2016 07:41 AM |
Maybe if I do..
blahblah..PlayerAdded:connect(function(player) newguy = player end)
newguy.CharacterAdded:connect(function(character) -- do stuff end)
..? |
|
|
| Report Abuse |
|
|
| |
|
|
| 04 Aug 2016 07:53 AM |
Are you sure
"game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) -- stuff end) end)"
Only works when they first enter? It works all the time for when I use it. Well if it doesn't work for whatever reason, put all the events in a table.
local signals = { } game.Players.PlayerAdded:connect(function(player) signals[player] = player.CharacterAdded:connect(function(character) -- stuff end) end)
game.Players.PlayerRemoving:connect(function(player) signals[player] = signals[player]:disconnect() end) |
|
|
| Report Abuse |
|
|
bloberous
|
  |
| Joined: 07 Jun 2009 |
| Total Posts: 299 |
|
|
| 04 Aug 2016 07:53 AM |
| Well that failed miserably. |
|
|
| Report Abuse |
|
|
windocat
|
  |
| Joined: 05 Jan 2013 |
| Total Posts: 1977 |
|
|
| 04 Aug 2016 07:54 AM |
Experiencing the same issue, though only when FE is enabled.
I have found no fix. :/
|
|
|
| Report Abuse |
|
|
bloberous
|
  |
| Joined: 07 Jun 2009 |
| Total Posts: 299 |
|
|
| 04 Aug 2016 07:54 AM |
| @Flux I'm *pretty* sure, but I'll mess around with some stuff more. |
|
|
| Report Abuse |
|
|
|
| 04 Aug 2016 07:58 AM |
I just tested it and it still works, it's something on your end.
This was my code: game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) print(player.Name .. " has respawned") end) end)
And I killed myself 5 times and it worked. |
|
|
| Report Abuse |
|
|
bloberous
|
  |
| Joined: 07 Jun 2009 |
| Total Posts: 299 |
|
|
| 04 Aug 2016 07:59 AM |
Maybe it has something to do with the stuff I make it do?
What I make it do is it clones a LocalScript (script.LocalScript:Clone()) and places it into the character, and also clones a ScreenGUI (script.ScreenGUI:Clone()) and places it into the player's PlayerGui.
I have Filtering Enabled on. Is there a problem there? |
|
|
| Report Abuse |
|
|
windocat
|
  |
| Joined: 05 Jan 2013 |
| Total Posts: 1977 |
|
|
| 04 Aug 2016 08:03 AM |
@blob
When I turn off FE, the issue fades. I think it is, but there's no way to fix?
Unless you'd do something like
player.Character:WaitForChild('Humanoid').Died:connect(function() repeat wait() until player.Character end)
I have no idea if that would work, but it's worth a try.
|
|
|
| Report Abuse |
|
|
|
| 04 Aug 2016 08:03 AM |
Heh. Funny. I just tested this:
'game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) print(player.Name .. " respawned."); Instance.new("Frame", Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))).Size = UDim2.new(0, 500, 0, 500); end) end)'
And it printed they respawned, but the GUI was only created when they first spawned. Strange.
report on bug tracker. |
|
|
| Report Abuse |
|
|
windocat
|
  |
| Joined: 05 Jan 2013 |
| Total Posts: 1977 |
|
|
| 04 Aug 2016 08:05 AM |
Hope this is fixed soon, this will keep all of the GUIs I sell from being FE-supported.
|
|
|
| Report Abuse |
|
|
bloberous
|
  |
| Joined: 07 Jun 2009 |
| Total Posts: 299 |
|
|
| 04 Aug 2016 08:10 AM |
What's bug tracker?
Anyway, I just removed the middle-man for transferring the GUI and just placed it in StarterGui. I'd really prefer it to be in the script though. It seems that GUI's aren't going through for some reason or something. |
|
|
| Report Abuse |
|
|
bloberous
|
  |
| Joined: 07 Jun 2009 |
| Total Posts: 299 |
|
|
| 04 Aug 2016 08:16 AM |
| I'm sure this is just something that we can't understand. Something about Filtering Enabled that just makes it weird. |
|
|
| Report Abuse |
|
|
|
| 04 Aug 2016 08:25 AM |
Maybe use Died Event. for i,v in pairs(game.Players:GetPlayers()) do if v:FindFirstChild("Character") ~= nil then v.Character.Humanoid.Died:connect(function() -- Stuff end) end end
#code for i,v in pairs(game.Players:GetPlayers()) do v.Character:BreakJoints() end |
|
|
| Report Abuse |
|
|
bloberous
|
  |
| Joined: 07 Jun 2009 |
| Total Posts: 299 |
|
|
| 04 Aug 2016 08:30 AM |
| If I use the Died event, it would clone the GUI into the PlayerGui, which would disappear after the player respawns. It's counter-intuitive. |
|
|
| Report Abuse |
|
|
|
| 04 Aug 2016 08:35 AM |
from the wiki:
"When [Filtering Enabled] is true, a Player's PlayerGui will not replicate to the server. It will only exist on the client. This means that Scripts within PlayerGui will not run, and the server will be unable to access it."
|
|
|
| Report Abuse |
|
|
|
| 04 Aug 2016 08:38 AM |
you need to use a remote event
when i tested, the GUIs appear in the PlayerGui on the server but not on the client because it gets filtered
what is weird though, is how the first time the GUI shows up (in test server) maybe it has something to do with the first player spawning before ROBLOX sees if FE is checked? |
|
|
| Report Abuse |
|
|
|
| 04 Aug 2016 08:45 AM |
for every first respawn of every player, it replicates
but after that it doesn't
what you could do is turn off ResetPlayerGuiOnSpawn and the GUI will always stay there, but the scripts and the gui will not reset upon a player's respawn |
|
|
| Report Abuse |
|
|