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: Respawn Event?

Previous Thread :: Next Thread 
bloberous is not online. 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
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
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 is not online. 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
Infunction is not online. Infunction
Joined: 20 Nov 2011
Total Posts: 7547
04 Aug 2016 07:46 AM
That should work.


Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
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 is not online. bloberous
Joined: 07 Jun 2009
Total Posts: 299
04 Aug 2016 07:53 AM
Well that failed miserably.
Report Abuse
windocat is not online. 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 is not online. 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
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
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 is not online. 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 is not online. 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
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
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 is not online. 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 is not online. 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 is not online. 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
PurelyMystic is not online. PurelyMystic
Joined: 24 May 2010
Total Posts: 931
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 is not online. 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
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
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
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
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
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
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
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