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: Whats wrong with this script...?

Previous Thread :: Next Thread 
Zarteon is not online. Zarteon
Joined: 25 Apr 2011
Total Posts: 2085
01 Dec 2012 11:11 AM
function onPlayerRespawned(newPlayer)
wait(1)

local Character = newPlayer.Character

if Character.Torso ~= nil then
Character.Torso.Transparency = 1
end
if Character.Head ~= nil then
Character.Head.Transparency = 1
end
if Character.Head.face.Texture ~= nil then
Character.Head.face.Texture = " "
end
if Character:findFirstChild("Right Leg") ~= nil then
Character:findFirstChild("Right Leg").Transparency = 1
end
if Character:findFirstChild("Left Leg") ~= nil then
Character:findFirstChild("Left Leg").Transparency = 1
end
if Character:findFirstChild("Right Arm") ~= nil then
Character:findFirstChild("Right Arm").Transparency = 1
end
if Character:findFirstChild("Left Arm") ~= nil then
Character:findFirstChild("Left Arm").Transparency = 1
end

local x = Character:GetChildren()
for i=1, #x do
if x[i].className == "Hat" then
x[i]:Remove()
end
end

local y = Character.Head:GetChildren()
for x=1, #y do
if y[x].className == "Sound" then
x[i]:Remove()
end
end

function onPlayerEntered(newPlayer)
newPlayer.Changed:connect(function(property)
if (property == "Character") then
onPlayerRespawned(newPlayer)
end
end)
end
end

game.Players.ChildAdded:connect(onPlayerEntered)



It's getting on my nerves...

It keeps outputting...

"17:10:24 - attempt to call a nil value
17:10:24 - Disconnected event because of exception"
Report Abuse
Zarteon is not online. Zarteon
Joined: 25 Apr 2011
Total Posts: 2085
01 Dec 2012 11:19 AM
Bump.
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
01 Dec 2012 11:20 AM
Post the EXACT output, and maybe I could help.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
01 Dec 2012 11:21 AM
function onPlayerRespawned(newPlayer)
wait(1)

local Character = newPlayer.Character

if Character.Torso ~= nil then
Character.Torso.Transparency = 1
end
if Character.Head ~= nil then
Character.Head.Transparency = 1
end
if Character.Head.face.Texture ~= nil then
Character.Head.face.Texture = " "
end
if Character:findFirstChild("Right Leg") ~= nil then
Character:findFirstChild("Right Leg").Transparency = 1
end
if Character:findFirstChild("Left Leg") ~= nil then
Character:findFirstChild("Left Leg").Transparency = 1
end
if Character:findFirstChild("Right Arm") ~= nil then
Character:findFirstChild("Right Arm").Transparency = 1
end
if Character:findFirstChild("Left Arm") ~= nil then
Character:findFirstChild("Left Arm").Transparency = 1
end

local x = Character:GetChildren()
for i=1, #x do
if x[i].className == "Hat" then
x[i]:Remove()
end
end

local y = Character.Head:GetChildren()
for x=1, #y do
if y[x].className == "Sound" then
x[i]:Remove()
end
end
end

function onPlayerEntered(newPlayer)
newPlayer.Changed:connect(function(property)
if (property == "Character") then
onPlayerRespawned(newPlayer)
end
end)
end

game.Players.ChildAdded:connect(onPlayerEntered)


- thedestroyer115
Report Abuse
Protecter17 is not online. Protecter17
Joined: 18 Sep 2010
Total Posts: 2130
01 Dec 2012 11:24 AM
function onPlayerRespawned(newPlayer) --define.
wait(1)

local Character = newPlayer.Character

if Character.Torso ~= nil then
Character.Torso.Transparency = 1
end
if Character.Head ~= nil then
Character.Head.Transparency = 1
end
if Character.Head.face.Texture ~= nil then
Character.Head.face.Texture = " "
end
if Character:findFirstChild("Right Leg") ~= nil then
Character:findFirstChild("Right Leg").Transparency = 1
end
if Character:findFirstChild("Left Leg") ~= nil then
Character:findFirstChild("Left Leg").Transparency = 1
end
if Character:findFirstChild("Right Arm") ~= nil then
Character:findFirstChild("Right Arm").Transparency = 1
end
if Character:findFirstChild("Left Arm") ~= nil then
Character:findFirstChild("Left Arm").Transparency = 1
end

local x = Character:GetChildren()
for i=1, #x do
if x[i].className == "Hat" then
x[i]:Remove()
end
end

local y = Character.Head:GetChildren()
for x=1, #y do
if y[x].className == "Sound" then
x[i]:Remove()
end
end
end

function onPlayerEntered(newPlayer) --define?
newPlayer.Changed:connect(function(property)
if (property == "Character") then
onPlayerRespawned(newPlayer) --did you define onPlayer?
end
end)
end

game.Players.ChildAdded:connect(onPlayerEntered) ---Did you define?


Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
01 Dec 2012 11:29 AM
Ignore Protector17. He totally failed. He defined all of those.

- thedestroyer115
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
01 Dec 2012 11:36 AM
It usually tells you the line where the error occured, in the output. Was that all it said?
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
01 Dec 2012 11:44 AM
Have you used my script yet? ._.

- thedestroyer115
Report Abuse
Zarteon is not online. Zarteon
Joined: 25 Apr 2011
Total Posts: 2085
01 Dec 2012 12:01 PM
Sorry for delay, TheDestroyer115. I used your script and received this output message "Workspace.Script:38: attempt to index local 'x' (a number value)"
Report Abuse
Zarteon is not online. Zarteon
Joined: 25 Apr 2011
Total Posts: 2085
01 Dec 2012 12:17 PM
Bump.
Report Abuse
Zarteon is not online. Zarteon
Joined: 25 Apr 2011
Total Posts: 2085
01 Dec 2012 12:31 PM
Bump...
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
01 Dec 2012 01:33 PM
WOW! Sorry! My epic fail:


function onPlayerRespawned(newPlayer)
wait(1)

local Character = newPlayer.Character

if Character.Torso ~= nil then
Character.Torso.Transparency = 1
end
if Character.Head ~= nil then
Character.Head.Transparency = 1
end
if Character.Head.face.Texture ~= nil then
Character.Head.face.Texture = " "
end
if Character:findFirstChild("Right Leg") ~= nil then
Character:findFirstChild("Right Leg").Transparency = 1
end
if Character:findFirstChild("Left Leg") ~= nil then
Character:findFirstChild("Left Leg").Transparency = 1
end
if Character:findFirstChild("Right Arm") ~= nil then
Character:findFirstChild("Right Arm").Transparency = 1
end
if Character:findFirstChild("Left Arm") ~= nil then
Character:findFirstChild("Left Arm").Transparency = 1
end


for _,x in pairs(newPlayer.Character:GetChildren())
if x:IsA("Hat") then
x:Destroy()
end
end

for _,v in pairs(newPlayer.Character.Head:GetChildren())
if v:IsA("Sound") then
v:Destroy()
end
end end

function onPlayerEntered(newPlayer)
newPlayer.Changed:connect(function(property)
if (property == "Character") then
onPlayerRespawned(newPlayer)
end
end)
end

game.Players.ChildAdded:connect(onPlayerEntered)


- thedestroyer115
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
01 Dec 2012 01:39 PM
Lol, no worries. You just needed to change a line. He started a new thread for some reason, when it wasn't getting replies. However, I told him to use yours with one line changed. Other than that, it was all good.

Link to other thread:
http://www.roblox.com/Forum/ShowPost.aspx?PostID=83412886
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
01 Dec 2012 01:44 PM
Link to the answer to your problems:
Two posts above this one.

- thedestroyer115
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
01 Dec 2012 01:44 PM
AKA: MY SCRIPT!

- thedestroyer115
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