RTSx1Join Date: 2011-05-24 Post Count: 486 |
Is it possible to put a model in a certain position?
My commented line is where I'm having trouble (line 7).
I just want to know how to do this.
Thanks!
local lPlayer = game.Players.LocalPlayer
local mouse = lPlayer:GetMouse()
local pOBJ = lPlayer:WaitForChild("OBJ_Val")
mouse.Button1Down:connect(function()
local obj = game.Lighting:FindFirstChild(pOBJ.Value)
--obj.Position = mouse.Hit.p
end)
"I can't change the direction of the wind, but I can adjust my sails to always reach my destination." |
|
cntkillmeJoin Date: 2008-04-07 Post Count: 49450 |
obj:MoveTo(mouse.Hit.p) |
|
RTSx1Join Date: 2011-05-24 Post Count: 486 |
Thanks, but it returns "10:05:36.622 - pOBJ is not a valid member of Lighting"
local lPlayer = game.Players.LocalPlayer
local mouse = lPlayer:GetMouse()
local pOBJ_Val = lPlayer:WaitForChild("OBJ_Val")
local pOBJ = pOBJ_Val.Value
mouse.Button1Down:connect(function()
local obj = game.Lighting.pOBJ
obj:MoveTo(mouse.Hit.p)
end) |
|
RTSx1Join Date: 2011-05-24 Post Count: 486 |
Bump |
|
|
Check your hierarchy, and check for typos. pOBJ does not exist in game.Lighting |
|
|
Might it be that the script loaded before pOBJ did? |
|
RTSx1Join Date: 2011-05-24 Post Count: 486 |
I think it is because the script took pOBJ literally. I want it to find whatever the value of pOBJ is, in this case, "Chair". I want it to find the model "Chair" in lighting. |
|
|
If it's a StringValue;
local lPlayer = game.Players.LocalPlayer
local mouse = lPlayer:GetMouse()
local pOBJ_Val = lPlayer:WaitForChild("OBJ_Val")
local pOBJ = pOBJ_Val.Value
mouse.Button1Down:connect(function()
local obj = game.Lighting[pOBJ]
obj:MoveTo(mouse.Hit.p)
end)
If it's an ObjectValue;
local lPlayer = game.Players.LocalPlayer
local mouse = lPlayer:GetMouse()
local pOBJ_Val = lPlayer:WaitForChild("OBJ_Val")
local pOBJ = pOBJ_Val.Value
mouse.Button1Down:connect(function()
local obj = pOBJ
obj:MoveTo(mouse.Hit.p)
end) |
|
RTSx1Join Date: 2011-05-24 Post Count: 486 |
Thanks, its a StringValue, but none of them work |
|
RTSx1Join Date: 2011-05-24 Post Count: 486 |
bump |
|
RTSx1Join Date: 2011-05-24 Post Count: 486 |
b2 |
|
|
ur function is missing an arg
and u didnt clone the model and change its parent
and u need Workspace:ClearAllChildren() |
|
RTSx1Join Date: 2011-05-24 Post Count: 486 |
local lPlayer = game.Players.LocalPlayer
local mouse = lPlayer:GetMouse()
local pOBJ_Val = lPlayer:WaitForChild("OBJ_Val")
local pOBJ = pOBJ_Val.Value
mouse.Button1Down:connect(function(pC)
local obj = game.Lighting.pOBJ:Clone()
obj.Parent = game.Workspace
obj:MoveTo(mouse.Hit.p)
end)
Still has same error but thanks |
|
|
cant believe u dont see that error lmao |
|
RTSx1Join Date: 2011-05-24 Post Count: 486 |
What do I do? |
|
cntkillmeJoin Date: 2008-04-07 Post Count: 49450 |
local obj = game.Lighting[pOBJ]:Clone()
|
|
RTSx1Join Date: 2011-05-24 Post Count: 486 |
local lPlayer = game.Players.LocalPlayer
local mouse = lPlayer:GetMouse()
local pOBJ_Val = lPlayer:WaitForChild("OBJ_Val")
local pOBJ = pOBJ_Val.Value
mouse.Button1Down:connect(function(pC)
local obj = game.Lighting[pOBJ]:Clone()
obj.Parent = game.Workspace
obj:MoveTo(mouse.Hit.p)
end)
It says " is not a valid member of lighting" |
|
|
nobody help this guy anymore ok |
|
RTSx1Join Date: 2011-05-24 Post Count: 486 |
:/ |
|
|
RTSx1Join Date: 2011-05-24 Post Count: 486 |
The value of a string value |
|
|
local lPlayer = game.Players.LocaIPlayer
local mouse = IPlayer:GetMouse()
local pOBJ_Val = IPlayer:WaitForChild("OBJ_VaI")
local pOBJ = pOBJ_Val.Value
mouse.Button1Down:connect(function(pC)
local obj = game.Lighting.pOBJ:Clone()
obj.Parent = game.Worksqace
obj:MoveTo(mouse.Hit.p)
end)
tested and it works |
|
RTSx1Join Date: 2011-05-24 Post Count: 486 |
Thanks, but thats the same thing |
|
|
RTSx1Join Date: 2011-05-24 Post Count: 486 |
Chair |
|