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 » Scripting Helpers
Home Search
 

Re: Should this work?

Previous Thread :: Next Thread 
Ignitor321 is not online. Ignitor321
Joined: 05 Apr 2009
Total Posts: 4201
22 Oct 2010 03:40 PM
function onPlayerRespawned(newplayer)
if newplayer:findFirstChild("Humanoid") then
b = Instance.new("Forcefield")
b.Parent = newplayer.Character
end
end

game.Workspace.ChildAdded:connect(onPlayerRespawned)

It should give you a forcefield when you spawn.
Report Abuse
iownedu89 is not online. iownedu89
Joined: 18 May 2009
Total Posts: 586
22 Oct 2010 03:42 PM
function onPlayerRespawned(newplayer)
if newplayer:findFirstChild("Humanoid") then
b = Instance.new("Forcefield")
b.Parent = newplayer
end
end

game.Workspace.ChildAdded:connect(onPlayerRespawned)
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
22 Oct 2010 03:43 PM
Don't you already get a forcefield when you respawn?
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
22 Oct 2010 03:44 PM
h = newplayer:findFirstChild("Humanoid")

function onPlayerRespawned(newplayer)
if h ~= nil then
b = Instance.new("ForceField")
b.Parent = newplayer.Character
end
end

game.Workspace.ChildAdded:connect(onPlayerRespawned)

--not sure, never did anythin like this, but 1 mistake is ForceField, F wasnt capitalized.

Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
22 Oct 2010 03:45 PM
@crazypotato4

Yes, you get forcefield, but if there is no Spawn, then you don't.
Report Abuse
Ignitor321 is not online. Ignitor321
Joined: 05 Apr 2009
Total Posts: 4201
22 Oct 2010 03:46 PM
Of course...Capitalization is my mistake..Again. >.<
Report Abuse
flappydavid is not online. flappydavid
Joined: 03 May 2009
Total Posts: 5893
22 Oct 2010 03:46 PM
Lol, shouldn't you already have a ForceField when you respawn??
Report Abuse
Ignitor321 is not online. Ignitor321
Joined: 05 Apr 2009
Total Posts: 4201
22 Oct 2010 03:47 PM
Although it still doesn't work.
Report Abuse
Ignitor321 is not online. Ignitor321
Joined: 05 Apr 2009
Total Posts: 4201
22 Oct 2010 03:48 PM
Flappy, I want the Forcefield to go on until it is removed.

game.Workspace.FloodCheck:Remove()
Hate it.
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
22 Oct 2010 03:48 PM
Try this:
---------------------------------------------------------------------------------

h = newplayer:findFirstChild("Humanoid")

function onPlayerRespawned(newplayer)
if h ~= nil then
b = Instance.new("ForceField")
b.Parent = newplayer.Character
end
end

game.Workspace.ChildAdded:connect(onPlayerRespawned)

If that won't work try this below:
----------------------------------------------------------------------------------

function onPlayerRespawned(newplayer)
if newplayer:findFirstChild("Humanoid") then
b = Instance.new("ForceField")
b.Parent = newplayer.Character
end
end

game.Workspace.ChildAdded:connect(onPlayerRespawned)

Report Abuse
Ignitor321 is not online. Ignitor321
Joined: 05 Apr 2009
Total Posts: 4201
22 Oct 2010 03:51 PM
Alright, this is a script that DID work, but it gave me a forcefield forever, I couldn't remove it, the script just put in a new one.

while wait() do
for i,v in pairs(game.Players:GetPlayers()) do
repeat wait() until v.Character
if v.Character:findFirstChild("ForceField") == nil then
Instance.new("ForceField",v.Character)
end
end
end


Could someone edit it so it doesn't come back until you respawn?
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
22 Oct 2010 03:53 PM
Im not sure, i would of make a big GUI screen "Press to continue" and when you press then it gives you FF and removes the GUI. xD
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
22 Oct 2010 03:55 PM
Oh and that script that worked is set if it is nil then it inserts, so whenever you remove ForceField, it inserts new.
Report Abuse
Ignitor321 is not online. Ignitor321
Joined: 05 Apr 2009
Total Posts: 4201
22 Oct 2010 03:56 PM
Well, that script is a little complicated for me, could you edit it to only give you one when you respawn?
Report Abuse
Spectrumw is not online. Spectrumw
Joined: 04 Aug 2009
Total Posts: 13510
22 Oct 2010 03:57 PM
@Crni
Any of your scripts will work, you only have newPlayer defined inside the function... so you 'h' is a nil value.
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
22 Oct 2010 03:59 PM
You people aren't very good at this, are you?

function onPlayerRespawned(newplayer)
if newplayer:findFirstChild("Humanoid") == nil then --if the forcefield ISNT ALREADY THERE.
b = Instance.new("ForceField", newplayer) -- NEWPLAYER IS THE CHARACTER.
end
end

game.Workspace.ChildAdded:connect(onPlayerRespawned)
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
22 Oct 2010 04:00 PM
Lol, i was about to post that xD
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
22 Oct 2010 04:00 PM
ohwait, logic fail on my part.

function onPlayerRespawned(newplayer)
if newplayer:findFirstChild("Humanoid") then
b = Instance.new("ForceField:, newplayer) -- STILL THE SAME
end
end

game.Workspace.ChildAdded:connect(onPlayerRespawned)

Thought you were checking for the forcefield, not the humanoid ;P
Report Abuse
Spectrumw is not online. Spectrumw
Joined: 04 Aug 2009
Total Posts: 13510
22 Oct 2010 04:00 PM
Hey crazy >3 just a few more posts till 4k
Report Abuse
Ignitor321 is not online. Ignitor321
Joined: 05 Apr 2009
Total Posts: 4201
22 Oct 2010 04:01 PM
@Crazy

Doesn't work. D:
Report Abuse
Spectrumw is not online. Spectrumw
Joined: 04 Aug 2009
Total Posts: 13510
22 Oct 2010 04:01 PM
function onPlayerRespawned(newplayer)
if newplayer:findFirstChild("Humanoid") then
b = Instance.new("ForceField", newplayer) -- STILL THE SAME
end
end

game.Workspace.ChildAdded:connect(onPlayerRespawned)


-- As long i know, you can not close a " with a :.
Report Abuse
Ignitor321 is not online. Ignitor321
Joined: 05 Apr 2009
Total Posts: 4201
22 Oct 2010 04:04 PM
Still not working..... D:
Report Abuse
chris1989 is not online. chris1989
Joined: 30 Nov 2007
Total Posts: 2520
22 Oct 2010 04:06 PM
You all fail...

game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(c)
Instance.new("ForceField" c)
end)
end)
Report Abuse
harutsedo is not online. harutsedo
Joined: 11 Oct 2009
Total Posts: 5150
22 Oct 2010 04:07 PM
As do you.

game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(c)
Instance.new("ForceField", c)
end)
end)
Report Abuse
Ignitor321 is not online. Ignitor321
Joined: 05 Apr 2009
Total Posts: 4201
22 Oct 2010 04:10 PM
Nope, doesn't work.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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