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
 

why would this not work in multiplayer?

Previous Thread :: Next Thread 
Xanth is not online. Xanth
Joined: 14 Oct 2007
Total Posts: 7691
23 Jul 2016 10:45 AM
This is a script within a PlayerGui, so you spawn with the script inside of your Player.

script.Parent.Parent.Parent.Character.Torso.CFrame = game.Workspace.RespawnRoom.CFrame + Vector3.new(0,5,0)

It works in studio testing mode but doesn't work in multiplayer. I'm wondering if this has to do with it needing to be a local script or not but I'm not sure.
Report Abuse
nox7 is not online. nox7
Joined: 29 Aug 2008
Total Posts: 27467
23 Jul 2016 10:49 AM
That's a .... bad way of doing it. Yes, use a LocalScript. Use this code:

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:wait()

character:WaitForChild("Torso").CFrame = workspace:WaitForChild("RespawnRoom", 7).CFrame + Vector3.new(0,5,0)
Report Abuse
Xanth is not online. Xanth
Joined: 14 Oct 2007
Total Posts: 7691
23 Jul 2016 10:51 AM
Oh I forgot to mention that I don't need to wait for things to load. This script is triggered by something else once the game has loaded so you really don't have to wait for anything to load still.
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
23 Jul 2016 10:53 AM
it should be a localscript and reference the localplayer's character either way
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
23 Jul 2016 11:03 AM
--local script

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:wait()
local torso = char.Torso

torso.CFrame = workspace.RespawnRoom.CFrame * CFrame.new(0,5,0)

However I suggest you do this on the server. there is not really point to move the character on the client...


Report Abuse
nox7 is not online. nox7
Joined: 29 Aug 2008
Total Posts: 27467
23 Jul 2016 11:08 AM
" * CFrame.new(0,5,0)"

What if it's upside down.
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