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 » Scripting Helpers
Home Search
 

Re: Shed some light?

Previous Thread :: Next Thread 
IAmReallyAwesome is not online. IAmReallyAwesome
Joined: 05 Mar 2010
Total Posts: 7371
25 Jul 2013 02:48 PM
Hey, I have this script and everything works fine besides changing the character's position. I test this in a server, not using Play Solo, so there is no output.

game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Model", player)
leaderstats.Name = "leaderstats"
local money = Instance.new("IntValue", leaderstats)
money.Name = "Stage"
money.Value = 1
player.CharacterAdded:connect(function(character)
if character:FindFirstChild("Torso") then --Not necessary, used for testing.
character.Torso.CFrame = CFrame.new(Vector3.new(0,3,0) + game.Workspace.Spawns:FindFirstChild(money.Value).Position)
end
end)
end)

--You may realize that I used both CFrame and Vector3. This is because I've used the pattern before in different scripts, and it works fine.

*Tell me about the rabbits, George*
Report Abuse
FriendlyScripter is not online. FriendlyScripter
Joined: 19 Feb 2012
Total Posts: 222
25 Jul 2013 02:51 PM
character.Torso.CFrame = CFrame.new(0,3,0) * game.Workspace.Spawns.money.Value.CFrame

Umm....


Please tell me what is a part and intvalue and etc for further help
Report Abuse
IAmReallyAwesome is not online. IAmReallyAwesome
Joined: 05 Mar 2010
Total Posts: 7371
25 Jul 2013 02:55 PM
Ah sorry I forgot to add that part.

In player: Player->leaderstats (model defined as leaderstats)-> Stage (IntValue defined as money)
In Workspace: Workspace->Spawns->Parts that are named as numbers (corresponding to money.Value)

*Tell me about the rabbits, George*
Report Abuse
IAmReallyAwesome is not online. IAmReallyAwesome
Joined: 05 Mar 2010
Total Posts: 7371
25 Jul 2013 02:57 PM
The idea is to teleport the character to the Part in Spawns whose name is equal to the player's money.Value when the character respawns.

*Tell me about the rabbits, George*
Report Abuse
FriendlyScripter is not online. FriendlyScripter
Joined: 19 Feb 2012
Total Posts: 222
25 Jul 2013 03:02 PM
Which axis are you trying to add onto the Character's torso?

eg:

.Blah.CFrame = CFrame.new(0,3,0) * CFrame.new(0,money.value,0)
or

.Blah.CFrame = CFrame.new(0,3,0) * CFrame.new(money.value,0,0)

or

.Blah.CFrame = CFrame.new(0,3,0) * CFrame.new(0,0,money.value)
Report Abuse
IAmReallyAwesome is not online. IAmReallyAwesome
Joined: 05 Mar 2010
Total Posts: 7371
25 Jul 2013 03:06 PM
no,no I have no problem with the CFrame part, I understand how that works. I am having trouble relating it to the Part in model Spawns that has the same name as money.Value.

game.Workspace.Spawns:FindFirstChild(money.Value) --That is the problem.
Report Abuse
FriendlyScripter is not online. FriendlyScripter
Joined: 19 Feb 2012
Total Posts: 222
25 Jul 2013 03:10 PM
That'd be;


game.Workspace.Spawns:FindFirstChild("money").Value


Make sure you use the correct capitalization.
Report Abuse
IAmReallyAwesome is not online. IAmReallyAwesome
Joined: 05 Mar 2010
Total Posts: 7371
25 Jul 2013 03:13 PM
Right, but I'm not looking for money, I'm looking for the part whose name is the equivalent of money.Value
so I have game.Workspace.Spawns:FindFirstChild(money.Value) because it should find the part in spawns with name money.Value, which is 1. However, that line is not working too well for me.
Report Abuse
IAmReallyAwesome is not online. IAmReallyAwesome
Joined: 05 Mar 2010
Total Posts: 7371
25 Jul 2013 03:26 PM
Bump. This thing has really got me stumped.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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