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: Positioning Problem...

Previous Thread :: Next Thread 
VictoriousMaxPower is not online. VictoriousMaxPower
Joined: 14 Jan 2010
Total Posts: 841
09 Jul 2011 03:43 PM
I made a Script that worked perfectly fine and I then tried to make it so the model appeared infront of the Player. It now doesn't work at all, yet the Output says it should work. There are no errors in the output at all...
Here it is:


a = math.pi
b = math.pi

local mod = Instance.new("Model")
mod.Name = "hurricane"
mod.Parent = game.Workspace

function createPart()
local p = Instance.new("Part")
p.Anchored = true

-------------------------------------------------------------

amountInFront = 15
torsoNormal = humanoid.Parent.Torso.CFrame.lookVector
denom = math.abs(torsoNormal.x) + math.abs(torsoNormal.z)
posX = amountInFront * (torsoNormal.x/denom)
posZ = amountInFront * (torsoNormal.z/denom)
pos = Vector3.new(pos.x + posX,pos.y, pos.z + posZ)
p.Position = pos

-----------------------------------------------------------------

p.CFrame = CFrame.fromEulerAnglesXYZ(0,a,0) * CFrame.new(b,a,b)
a = a+00.1
b = b+0.035
p.Parent = mod
local m = Instance.new("BlockMesh")
m.Parent = p
end

function start()
for i = 1,1000 do
createPart()
wait()
end
end

function onChatted(msg, speaker)
if msg:lower() == "hurricane" then do
start()
wait()
end
end
end

game.Players.PlayerAdded:connect(function(p)
if p:IsInGroup(106362) then
p.Chatted:connect(function(msg) onChatted(msg, newPlayer) end)
end end)


The section in ------------- is the place where it positions.
I think it might be due to the fact that the PArt is Instance not Workspace. Can anyone help?
Report Abuse
ServerLabs is not online. ServerLabs
Joined: 29 Dec 2010
Total Posts: 2263
09 Jul 2011 03:47 PM
mod:MoveTo(PART_YOU_WANT_INFRONT_OF.CFrame+CFrame.new(5,0,0))

Try messing with that.
Report Abuse
VictoriousMaxPower is not online. VictoriousMaxPower
Joined: 14 Jan 2010
Total Posts: 841
09 Jul 2011 03:50 PM
So could I make that script ^ to be 15 studs infront of Player torso or something?
Report Abuse
ServerLabs is not online. ServerLabs
Joined: 29 Dec 2010
Total Posts: 2263
09 Jul 2011 03:55 PM
Yes sir, http://news.roblox.com/index.php/MoveTo
Report Abuse
VictoriousMaxPower is not online. VictoriousMaxPower
Joined: 14 Jan 2010
Total Posts: 841
09 Jul 2011 04:08 PM
Ah okay, so something like

mod:MoveTo(player.Torso.Position.CFrame+CFrame.new(5,0,0))

?
Report Abuse
VictoriousMaxPower is not online. VictoriousMaxPower
Joined: 14 Jan 2010
Total Posts: 841
09 Jul 2011 04:12 PM
Actually would

mod:MoveTo(Vector3.new(10,0,0))

be better?
Report Abuse
RATEXmegaGAMER is not online. RATEXmegaGAMER
Joined: 10 Dec 2010
Total Posts: 4046
09 Jul 2011 04:13 PM
It can't be player but it has to be the character of the player.
Report Abuse
ServerLabs is not online. ServerLabs
Joined: 29 Dec 2010
Total Posts: 2263
09 Jul 2011 04:25 PM
@Vic, that would move the model to 10,0,0, not infront of your character.
Report Abuse
VictoriousMaxPower is not online. VictoriousMaxPower
Joined: 14 Jan 2010
Total Posts: 841
10 Jul 2011 12:42 PM
I know that now. I wasn't thinking straight last night...
There is one problem with this though...
The script I desire to use it on Places the Bricks in Instance and the Model in Workspace. What can I do to make it move?
Report Abuse
ServerLabs is not online. ServerLabs
Joined: 29 Dec 2010
Total Posts: 2263
10 Jul 2011 05:06 PM
Part.Parent = Model

Change around "Part" to be the part you want to put in "Model"
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