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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 24 Feb 2016 |
| Total Posts: 549 |
|
| |
|
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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|