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: plr.Character

Previous Thread :: Next Thread 
Era_Gamer is not online. Era_Gamer
Joined: 24 Feb 2016
Total Posts: 549
13 Dec 2016 05:31 PM
Is there something weird with plr.Character when Filtering Enabled is on or am I just slow today


Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
13 Dec 2016 05:32 PM
Shouldn't be, but without context we can't really help you.
Report Abuse
Era_Gamer is not online. Era_Gamer
Joined: 24 Feb 2016
Total Posts: 549
13 Dec 2016 05:36 PM
charPos = CFrame.new(3.553, 3, 7.566)

function plrAdded(plr)
print(plr)
plr.CharacterAdded:Connect(setChar(plr.Character)) --I've tried leaving "plr.Character" blank as it should automatically pass the argument for character but idk

end

function setChar(char)
print(char.Parent..": Print #2")
char.HumanoidRootPart.CFrame = charPos
end

game.Players.PlayerAdded:connect(plrAdded)

18:30:49.209 - ServerScriptService.serverPlayerAdded:32: attempt to index local 'char' (a nil value)


Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
13 Dec 2016 05:39 PM
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
char.HumanoidrootPartCFrame = charPos
end)
end)


Report Abuse
Era_Gamer is not online. Era_Gamer
Joined: 24 Feb 2016
Total Posts: 549
13 Dec 2016 05:42 PM
ugh I DONT LIKE WRITING IT THAT WAY

its so boring and so ugly looking


Report Abuse
Era_Gamer is not online. Era_Gamer
Joined: 24 Feb 2016
Total Posts: 549
13 Dec 2016 05:44 PM
ok nevermind im slow LMAO


Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
13 Dec 2016 06:13 PM
Just to make sure the issue was made clear:


function plrAdded(plr)
print(plr)
plr.CharacterAdded:Connect(setChar(plr.Character)) --here, you are calling the function and then passing whatever it returns to Connect

end


Should be:


function plrAdded(plr)
print(plr)
plr.CharacterAdded:Connect(setChar) -- here, you are passing the function you want to set as the callback to Connect; this is what you should be doing
end
Report Abuse
DreamsWork is not online. DreamsWork
Joined: 20 Jan 2010
Total Posts: 36796
13 Dec 2016 06:15 PM
plr.CharacterAdded:Connect(setChar(plr.Character))

youre connecting the event to what 'setChar' returns. use this;

plr.CharacterAdded:Connect(function() setChar(plr.Character) end)


Downgrading STF // https://www.roblox.com/Trade/TradeWindow.aspx?TradePartnerID=6163444
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
13 Dec 2016 06:17 PM
"
plr.CharacterAdded:Connect(setChar(plr.Character))

youre connecting the event to what 'setChar' returns. use this;

plr.CharacterAdded:Connect(function() setChar(plr.Character) end)"

Nice, you repeated what I said and convoluted the solution.
Report Abuse
DreamsWork is not online. DreamsWork
Joined: 20 Jan 2010
Total Posts: 36796
13 Dec 2016 06:26 PM
didnt really read your response


Downgrading STF // https://www.roblox.com/Trade/TradeWindow.aspx?TradePartnerID=6163444
Report Abuse
Era_Gamer is not online. Era_Gamer
Joined: 24 Feb 2016
Total Posts: 549
13 Dec 2016 06:42 PM
game.Players.PlayerAdded:connect(function(player)
plrAdded(player)
player.CharacterAdded:connect(function(char)
setChar(char)
end)
end)


thats all i did to fix it


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