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: Onspawn teleportation, only works first time

Previous Thread :: Next Thread 
Erebodis is not online. Erebodis
Joined: 22 Jan 2011
Total Posts: 96
15 Sep 2016 03:56 AM
This script only seems to work when the player joins the game e.e And not when they respawn. Could anyone explain?

local target = CFrame.new(54, 82, 222)

game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
if player:IsInGroup(2941398) and player:GetRankInGroup(2941398) > 4 then
character:WaitForChild("Torso")
character.Torso.CFrame = target
end
end)
end)
Report Abuse
HlCOM is not online. HlCOM
Joined: 29 Mar 2009
Total Posts: 3332
15 Sep 2016 04:05 AM
the PlayerAdded line is when a player joins the game, this should work


player.CharacterAdded:connect(function(character)
if player:IsInGroup(2941398) and player:GetRankInGroup(2941398) > 4 then
character:WaitForChild("Torso")
character.Torso.CFrame = target
end
end)
Report Abuse
HlCOM is not online. HlCOM
Joined: 29 Mar 2009
Total Posts: 3332
15 Sep 2016 04:05 AM
nevermind give me a sec or if someone else swoops in they swoop in but this wont work either lol sorry its late
Report Abuse
Erebodis is not online. Erebodis
Joined: 22 Jan 2011
Total Posts: 96
15 Sep 2016 04:12 AM
Ohhhhmk. I can probs work out the rest for the directories. Thanks man.
Report Abuse
Erebodis is not online. Erebodis
Joined: 22 Jan 2011
Total Posts: 96
15 Sep 2016 04:14 AM
Ok yeah nvm found your predicament e.e
Report Abuse
HlCOM is not online. HlCOM
Joined: 29 Mar 2009
Total Posts: 3332
15 Sep 2016 04:20 AM
assuming this is a local script


player = game.Players.LocalPlayer
local target = CFrame.new(54, 82, 222)

player.CharacterAdded:connect(function(character)
if player:IsInGroup(2941398) and player:GetRankInGroup(2941398) > 4 then
character:WaitForChild("Torso")
wait()
character.Torso.CFrame = target
end
end)


didn't work without the wait() either, so now it waits for the WaitForChild before going ahead


Report Abuse
Erebodis is not online. Erebodis
Joined: 22 Jan 2011
Total Posts: 96
15 Sep 2016 04:23 AM
omk :o
Thanks man
Report Abuse
Erebodis is not online. Erebodis
Joined: 22 Jan 2011
Total Posts: 96
15 Sep 2016 04:34 AM
The different assignment of Player to Players makes the group conditions invalid I think :/ Should be able to work it out myself but it's taking a while e.e
Report Abuse
HlCOM is not online. HlCOM
Joined: 29 Mar 2009
Total Posts: 3332
15 Sep 2016 04:38 AM
I tested it with one of my groups and it fully worked, are you making it a LocalScript inside of StarterGui?
Report Abuse
Erebodis is not online. Erebodis
Joined: 22 Jan 2011
Total Posts: 96
15 Sep 2016 04:52 AM
Oh no I wasn't. I was just leaving it in the workspace e.e Thank you so much :/ Seen local scripts been put there before, I should've hooked on to the fact it was due to it include various Starter equipment?
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
15 Sep 2016 08:13 AM
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
if player:IsInGroup(2941398) and (player:GetRankInGroup(2941398) > 4) then
print('Pass')
local torso = char:WaitForChild('Torso')
torso.CFrame = CFrame.new(54,82,222)
end
end)
end)


Report Abuse
Erebodis is not online. Erebodis
Joined: 22 Jan 2011
Total Posts: 96
15 Sep 2016 08:13 AM
Pretty sure that didn't run for respawning. That was the issue


210,605 slices of pizza and counting
Report Abuse
Fluffy_Husky is not online. Fluffy_Husky
Joined: 23 May 2016
Total Posts: 763
15 Sep 2016 08:16 AM
local:
wait(0.08)
local c = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:wait()
c:WaitForChild("Torso").CFrame = target

server:
game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(char)
char:WaitForChild("Torso").CFrame = target
end)
end)
Report Abuse
Erebodis is not online. Erebodis
Joined: 22 Jan 2011
Total Posts: 96
15 Sep 2016 08:18 AM
The server one didn't seem to work.


210,605 slices of pizza and counting
Report Abuse
Fluffy_Husky is not online. Fluffy_Husky
Joined: 23 May 2016
Total Posts: 763
15 Sep 2016 08:20 AM
it should always work
idk what youre doing wrong
Report Abuse
Erebodis is not online. Erebodis
Joined: 22 Jan 2011
Total Posts: 96
15 Sep 2016 08:22 AM
ikr e.e If the answer isn't in the code above, guess there must be something else in the game conflicting..... Somehow 0.o


Ty guys.


210,605 slices of pizza and counting
Report Abuse
Fluffy_Husky is not online. Fluffy_Husky
Joined: 23 May 2016
Total Posts: 763
15 Sep 2016 08:23 AM
make a new baseplate and put a script in the workspace

put my server code and make sure you have 'target' defined
then play and reset
Report Abuse
Erebodis is not online. Erebodis
Joined: 22 Jan 2011
Total Posts: 96
15 Sep 2016 09:03 AM
Yeah, doesn't work for me then either. Only triggers on initial spawn when enters the server.

Local script works fine.


210,648 slices of pizza and counting
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