|
| 28 Aug 2016 08:22 PM |
| I want to set a player's spawn point without using a Spawn Location. It's for an obby. I know you can do this with CFrame but I can't get it to work. |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2016 08:25 PM |
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) [insert conditional here] character.HumanoidRootPart.Position = [Partname].Position end end) end)
I think something like that would work but dont quote me on it
+1 |
|
|
| Report Abuse |
|
|
Baseness
|
  |
| Joined: 07 Oct 2015 |
| Total Posts: 1001 |
|
|
| 28 Aug 2016 08:25 PM |
Player.CharacterAdded and CFrame to a position
|
|
|
| Report Abuse |
|
|
|
| 28 Aug 2016 08:27 PM |
| Nope, still doesn't work. That's pretty much the exact same thing I already did, except that I used Torso instead. |
|
|
| Report Abuse |
|
|
laczka
|
  |
| Joined: 26 Jan 2015 |
| Total Posts: 258 |
|
|
| 28 Aug 2016 08:29 PM |
Assuming that your main spawn is name spawnPart, the script would probably look a bit like this: local spawnPart = game:GetService("Workspace").spawnPart game:GetService("Players").PlayerAdded:connect(function(plr) local gamePlr = game:GetService("Workspace"):FindFirstChild(plr.Name) gamePlr:FindFirstChild("Torso").CFrame = CFrame.new(spawnPart.CFrame) gamePlr:FindFirstChild("Humanoid").Died:connect(function() repeat wait() until gamePlr:FindFirstChild("Humanoid").Health ~= 0 gamePlr.CFrame = CFrame.new(spawnPart.CFrame) end) end) |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2016 08:30 PM |
output errors?
try putting print functions within the functions to see if they're running or not
game.Players.PlayerAdded:connect(function(player) print('PlayerAdded') player.CharacterAdded:connect(function(character) print('CharacterAdded') [conditional] print('Conditional is true') character.HumanoidRootPart.Position = [Part].Position end end) end)
something like that to see if they're running properly. could be an issue with the conditional because its not true or something.
+1 |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2016 08:33 PM |
| @Flashiness I have done that already, it seems everything except the actual teleporting itself works. I don't see why the CFrame doesn't work though, since I tested it outside of the conditional. |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2016 08:34 PM |
| btw I used CFrame not Position. |
|
|
| Report Abuse |
|
|
laczka
|
  |
| Joined: 26 Jan 2015 |
| Total Posts: 258 |
|
|
| 28 Aug 2016 08:34 PM |
| @flashiness, or if he wants the game filtering enabled, he could :FireServer with a remoteEvent in a local script whenever a client joins, then from there take in input as a variable to the OnServerEvent function in a server script, and from there compare the input taken in without even needing to print unnecessarily. |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2016 08:34 PM |
Not sure then, You could try another method like :Lerp() or something but it should work. I really don't know why it isnt working then
+1 |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2016 08:36 PM |
| I've been staring at this line alone for 1 and a half hours... this shouldn't be that hard lol. |
|
|
| Report Abuse |
|
|
Skellobit
|
  |
| Joined: 13 Apr 2016 |
| Total Posts: 12758 |
|
|
| 28 Aug 2016 08:44 PM |
just add a Vector3Value/CFrameValue inside player or something and on CharacterAdded teleport them there :/
Formerly ToxicDominator - add 17,509 posts |
|
|
| Report Abuse |
|
|
llaserx
|
  |
| Joined: 10 Dec 2011 |
| Total Posts: 53069 |
|
| |
|