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: Why does this not work?

Previous Thread :: Next Thread 
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
11 Aug 2013 03:44 PM
There are no errors, but it doesn't do anything when I test it:

game.Players.PlayerAdded:connect(function(player)
local char = player.Character
char.Head.Transparency = 1
local fake = char.Head:Clone()
fake.name = "FakeHead"
local weld = Instance.new("Weld")
weld.Parent = char.Head
weld.Part0 = char.Head
weld.Part1 = char.FakeHead
player:WaitForDataReady()
if player.DataComplexity == 0 then
script.Parent.loginscreen.Visible = false
script.Parent.signupscreen.Visible = true
elseif player.DataComplexity > 0 then
script.Parent.loginscreen.Visible = true
script.Parent.signupscreen.Visible = false
end
end)
Report Abuse
mylifeis2cooldlol is not online. mylifeis2cooldlol
Joined: 08 Mar 2011
Total Posts: 874
11 Aug 2013 03:46 PM
Umm....they player im any studio test DOES NOT allow data persistence, so you will be waiting for the DataReady thing....


(Recommended...have a loading screen, or a signup..)
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
11 Aug 2013 03:48 PM
But the code for the fake head should run first.
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
11 Aug 2013 04:01 PM
bump
Report Abuse
mylifeis2cooldlol is not online. mylifeis2cooldlol
Joined: 08 Mar 2011
Total Posts: 874
11 Aug 2013 04:03 PM
local char = player.Character
char.Head.Transparency = 1
local fake = char.Head:Clone()
fake.name = "FakeHead"

When you clone the head, you clone it with the transparency added already >.<

local char = player.Character
local fake = char.Head:Clone()
char.Head.Transparency = 1
fake.name = "FakeHead"

That will clone it and make the origional clear :P
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
11 Aug 2013 04:59 PM
Ok, but with the original, it didn't even make the head transparent. It's like the script didn't even run at all!
Report Abuse
fireheart568 is not online. fireheart568
Joined: 04 Jan 2009
Total Posts: 1285
11 Aug 2013 05:00 PM
Put in some print() commands to see what is executing, what's holding it up, etc.
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
11 Aug 2013 07:01 PM
game.Players.PlayerAdded:connect(function(player)


That's the line that's screwed up! It would print anything after that line. But there are still no errors!
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
11 Aug 2013 07:01 PM
It printed the print statement I made before that line.
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
11 Aug 2013 07:18 PM
bump
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
11 Aug 2013 07:19 PM
The 'PlayerAdded' event doesn't work in solo mode, this is because the player is loaded before the scripts that connect the 'PlayerAdded' event are. This is stated on the Wiki in a big red box.
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
11 Aug 2013 07:25 PM
Theres no weld keeping head in place
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
11 Aug 2013 07:26 PM
oops, nevermind
You may have to do a CharacterAdded
or
repeat wait() until player.Character
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
12 Aug 2013 01:13 PM
Revised:

game.Players.PlayerAdded:connect(function(player)
local char = player.Character
char.Head.Transparency = 1
local fake = char.Head:Clone()
fake.Transparency = 0
fake.name = "FakeHead"
fake.Parent = char
local weld = Instance.new("Weld")
weld.Parent = char.Head
weld.Part0 = char.Head
weld.Part1 = char.FakeHead
player:WaitForDataReady()
if player.DataComplexity == 0 then
script.Parent.loginscreen.Visible = false
script.Parent.signupscreen.Visible = true
elseif player.DataComplexity > 0 then
script.Parent.loginscreen.Visible = true
script.Parent.signupscreen.Visible = false
end
end)





I tested it in onlne mode (tools>test>startserver>tools>test>startplayer), but it still didn't do aything, even with the changes shown above!
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
12 Aug 2013 01:26 PM
bump
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
12 Aug 2013 01:38 PM
bump
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
12 Aug 2013 01:50 PM
There's a magical being known as 'Output'. Now, if you had of read the output in the server window, you would have noticed...

"Time:Time:Time:Time - Something.Something:3: attempt to index local 'char' (a nil value)"

1) When the 'PlayerAdded' event is triggered, the player's character isn't there instantly.
2) You'll find that this will only do what you want when they first join. If they reset, etc, they'll be the same as a normal character.
3) It's 'Name' not 'name'. (Line 6)
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
12 Aug 2013 02:01 PM
Revisions:

game.Players.PlayerAdded:connect(function(player)
repeat wait() until player.Character
local char = player.Character
char.Head.Transparency = 1
local fake = char.Head:Clone()
fake.Transparency = 0
fake.Name = "FakeHead"
fake.Parent = char
local weld = Instance.new("Weld")
weld.Parent = char.Head
weld.Part0 = char.Head
weld.Part1 = char.FakeHead
player:WaitForDataReady()
if player.DataComplexity == 0 then
script.Parent.loginscreen.Visible = false
script.Parent.signupscreen.Visible = true
elseif player.DataComplexity > 0 then
script.Parent.loginscreen.Visible = true
script.Parent.signupscreen.Visible = false
end
end)



I put "repeat wait() until player.Character" in there, and fixed the name thing like you said, but it still does nothing in online mode.

There are no errors either.
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
12 Aug 2013 02:14 PM
bump
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
12 Aug 2013 02:31 PM
Why do I always have to bump to get a reply!?
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
12 Aug 2013 02:32 PM
Why cant you be patient like the others?
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
12 Aug 2013 02:34 PM
What part? There are no visible errors, and the 'FakeHead' works fine.
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
12 Aug 2013 02:35 PM
Put the guis in lighting andill help
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
12 Aug 2013 03:58 PM
Ok, so you are saying that this script should work? Maybe I need to try it in an actual server.

Sorry I snapped, I just have to bump a lot :P
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
12 Aug 2013 07:19 PM
bump
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