|
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. |
|
|
|
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 |
|
|
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)"
|
|
|
^u again. Let me teach people thrust do. Not ur fake lua |
|
|
Let's not start an argument and be serious. Please. |
|
|
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)
|
|
|
Sorry for the bad grammar been playing sport in some really hot weather:
Ignore my previous post*
'player' as the local player*
|
|
|
@Advanced, Tested again. The brick keeps going at this position. -86.7, 101.8, -85.3 |
|
|
Maybe i could go on and try to Make it instance.new and things like that. than cloning it. |
|
|
Oh snap. i removed something and now it works. Thanks ^^ |
|
Thane_1Join Date: 2009-04-08 Post Count: 3406 |
You can't set it's position to a CFrame.
~ Who's awesome, you're awesome ~ |
|
|
Yes u can ;)
part.Position = CFrame.new(position)
|
|
Thane_1Join Date: 2009-04-08 Post Count: 3406 |
"bad argument #3 to 'Position' (Vector3 expected, got CFrame)"
~ Who's awesome, you're awesome ~ |
|
|
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)
|
|
|
Oops, got it mixed up with:
part.CFrame = CFrame.new(position)
my bad.
|
|