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: CFrame a part to Torso Position (gui)

Previous Thread :: Next Thread 
thesecondcomingdoom is not online. thesecondcomingdoom
Joined: 09 Feb 2016
Total Posts: 1020
11 Feb 2016 10:48 PM
local a = tool:clone()
a.Parent = game.Workspace
a.Position = CFrame.new(player.Character.Torso.Position)


(tool is already set)

tool = game.Lighting.Wood --the part i use
player = script.Parent.Parent.Parent.Parent.Parent


Doesn't seem to be going to the player.
Report Abuse
ranvlr2o50 is not online. ranvlr2o50
Joined: 30 Jan 2016
Total Posts: 46
11 Feb 2016 10:50 PM
Use while thruse do
Report Abuse
thesecondcomingdoom is not online. thesecondcomingdoom
Joined: 09 Feb 2016
Total Posts: 1020
11 Feb 2016 10:51 PM
player = script.Parent.Parent.Parent.Parent.Parent
Hits = player.leaderstats.Wood
price = 1
tool = game.Lighting.Wood -- paart


function buy()
if Hits.Value >= price then
Hits.Value = Hits.Value - price
local a = tool:clone()
a.Parent = game.Workspace
a.Position = CFrame.new(player.Character.Torso.Position.CFrame)
end
end
script.Parent.MouseButton1Down:connect(buy)


@ranvlr2o50


Full script
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
11 Feb 2016 10:51 PM
You've defined 'player' after setting the a's Position; so 'player' will be nil on this line:

"a.Position = CFrame.new(player.Character.Torso.Position)"



Report Abuse
ranvlr2o50 is not online. ranvlr2o50
Joined: 30 Jan 2016
Total Posts: 46
11 Feb 2016 10:52 PM
^u again. Let me teach people thrust do. Not ur fake lua
Report Abuse
thesecondcomingdoom is not online. thesecondcomingdoom
Joined: 09 Feb 2016
Total Posts: 1020
11 Feb 2016 10:54 PM
Let's not start an argument and be serious. Please.
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
11 Feb 2016 10:58 PM
Ignore my previous one as it was a reply to your first anyways:

Use a local script and define 'player' has the local player

local player = game.Players.LocalPlayer as it saves the time of checking if you have the correct amount of 'parents' in the method you are using.

Unless you don't have the right amount of money I don't see anything wrong with your script.

local player = game.Players.LocalPlayer
local Hits = player.leaderstats.Wood
local price = 1
local tool = game.Lighting.Wood


function buy()
if Hits.Value >= price then
Hits.Value = Hits.Value - price
local a = tool:clone()
a.Parent = game.Workspace
a.Position = CFrame.new(player.Character.Torso.Position.CFrame)
end
end
script.Parent.MouseButton1Down:connect(buy)




Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
11 Feb 2016 11:00 PM
Sorry for the bad grammar been playing sport in some really hot weather:

Ignore my previous post*

'player' as the local player*



Report Abuse
thesecondcomingdoom is not online. thesecondcomingdoom
Joined: 09 Feb 2016
Total Posts: 1020
11 Feb 2016 11:02 PM
@Advanced, Tested again. The brick keeps going at this position. -86.7, 101.8, -85.3
Report Abuse
thesecondcomingdoom is not online. thesecondcomingdoom
Joined: 09 Feb 2016
Total Posts: 1020
11 Feb 2016 11:03 PM
Maybe i could go on and try to Make it instance.new and things like that. than cloning it.
Report Abuse
thesecondcomingdoom is not online. thesecondcomingdoom
Joined: 09 Feb 2016
Total Posts: 1020
11 Feb 2016 11:04 PM
Oh snap. i removed something and now it works. Thanks ^^
Report Abuse
XThane is not online. XThane
Joined: 08 Apr 2009
Total Posts: 2702
11 Feb 2016 11:12 PM
You can't set it's position to a CFrame.

~ Who's awesome, you're awesome ~
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
11 Feb 2016 11:14 PM
Yes u can ;)

part.Position = CFrame.new(position)



Report Abuse
XThane is not online. XThane
Joined: 08 Apr 2009
Total Posts: 2702
11 Feb 2016 11:16 PM
"bad argument #3 to 'Position' (Vector3 expected, got CFrame)"

~ Who's awesome, you're awesome ~
Report Abuse
thesecondcomingdoom is not online. thesecondcomingdoom
Joined: 09 Feb 2016
Total Posts: 1020
11 Feb 2016 11:18 PM
local player = game.Players.LocalPlayer
local Hits = player.leaderstats.Wood
local price = 1
local tool = game.Lighting.Wood


function buy()
if Hits.Value >= price then
Hits.Value = Hits.Value - price
local brick = Instance.new("Part")
brick.Anchored = true
brick.Size = Vector3.new (2,1,2)
brick.BrickColor = BrickColor.new ("Dark orange")
brick.Material = "Wood"
brick.Position = player.Character.Torso.Position-Vector3.new(0,1.3,0)
brick.Parent = game.Workspace
end
end
script.Parent.MouseButton1Down:connect(buy)
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
11 Feb 2016 11:19 PM
Oops, got it mixed up with:
part.CFrame = CFrame.new(position)

my bad.




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