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
 

Script Wont Work (Help Needed!)

Previous Thread :: Next Thread 
DevObject is not online. DevObject
Joined: 28 Jul 2011
Total Posts: 7048
26 Sep 2016 07:42 AM
Can someone fix this script for me? It wont work.

model = script.Parent.Parent
part = script.Parent

function onTouch(hit)
if hit.Parent.Humanoid then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local char = plr.Character
local humanoid = char:FindFirstChild('Humanoid')
if humanoid then
model:Clone()
model.CFrame = model.CFrame * CFrame.new(24,0,0)

end
end
end

script.Parent.Touched:connect(onTouch)


Lol'd >Add 5k posts, R.I.P. ROBLOXBaseWarsFPS1
Report Abuse
DevObject is not online. DevObject
Joined: 28 Jul 2011
Total Posts: 7048
26 Sep 2016 07:46 AM
By it doesn't work I mean it doesn't clone the model then move it.


Lol'd >Add 5k posts, R.I.P. ROBLOXBaseWarsFPS1
Report Abuse
Nagrath99 is not online. Nagrath99
Joined: 26 Mar 2011
Total Posts: 1537
26 Sep 2016 07:50 AM
if 'model' refers to an actual "Model" then you can't use CFrame on it
You should use model:MoveTo(Vector3)
Report Abuse
LockFocus is not online. LockFocus
Joined: 31 Aug 2013
Total Posts: 1044
26 Sep 2016 07:50 AM
models don't have a frame property. set a primary part
Report Abuse
DevObject is not online. DevObject
Joined: 28 Jul 2011
Total Posts: 7048
26 Sep 2016 07:50 AM
Oh okay, (Vector3.new)?


Lol'd >Add 5k posts, R.I.P. ROBLOXBaseWarsFPS1
Report Abuse
LockFocus is not online. LockFocus
Joined: 31 Aug 2013
Total Posts: 1044
26 Sep 2016 07:51 AM
damn autocorrect. frame should be cframe.
Report Abuse
DevObject is not online. DevObject
Joined: 28 Jul 2011
Total Posts: 7048
26 Sep 2016 07:52 AM
Would I use (Vector3.new(24,0,0)?


Lol'd >Add 5k posts, R.I.P. ROBLOXBaseWarsFPS1
Report Abuse
LockFocus is not online. LockFocus
Joined: 31 Aug 2013
Total Posts: 1044
26 Sep 2016 07:54 AM
model:MoveTo(model.Position + Vector3.new(24, 0, 0))
Report Abuse
LockFocus is not online. LockFocus
Joined: 31 Aug 2013
Total Posts: 1044
26 Sep 2016 07:55 AM
Oops, models don't have positions. But you get what I mean.
Report Abuse
DevObject is not online. DevObject
Joined: 28 Jul 2011
Total Posts: 7048
26 Sep 2016 07:55 AM
Thanks I'm new to scripting, and very new to Vectors, so I am learning.


Lol'd >Add 5k posts, R.I.P. ROBLOXBaseWarsFPS1
Report Abuse
DevObject is not online. DevObject
Joined: 28 Jul 2011
Total Posts: 7048
26 Sep 2016 07:58 AM
I put in (Vector3.new(1,0,0)) and it's teleporting the player as well, how can I fix this?


Lol'd >Add 5k posts, R.I.P. ROBLOXBaseWarsFPS1
Report Abuse
DevObject is not online. DevObject
Joined: 28 Jul 2011
Total Posts: 7048
26 Sep 2016 08:00 AM
It's not cloning ,thats the problem. Why is't it cloning? Isn't model:Clone() how you duplicate things.


Lol'd >Add 5k posts, R.I.P. ROBLOXBaseWarsFPS1
Report Abuse
Nagrath99 is not online. Nagrath99
Joined: 26 Mar 2011
Total Posts: 1537
26 Sep 2016 08:19 AM
For:

model:Clone()
model.Parent



You're cloning the original
and changing the parent of the original, not the clone

newmodel = model:Clone()
newmodel.Parent =
Report Abuse
DevObject is not online. DevObject
Joined: 28 Jul 2011
Total Posts: 7048
26 Sep 2016 08:23 AM
Nagrath, I don't have model.Parent anywhere in my script????

I'm fairly new to lua coding, so please explain a bit more?


Lol'd >Add 5k posts, R.I.P. ROBLOXBaseWarsFPS1
Report Abuse
Nagrath99 is not online. Nagrath99
Joined: 26 Mar 2011
Total Posts: 1537
26 Sep 2016 08:24 AM
Create a variable for the original - newmodel = model:clone()
Move the newly cloned model - newmodel:MoveBy(Vector3)
Set the parent of the moved model - newmodel.Parent =

Report Abuse
LockFocus is not online. LockFocus
Joined: 31 Aug 2013
Total Posts: 1044
26 Sep 2016 08:26 AM

model = script.Parent.Parent
part = script.Parent

function onTouch(hit)
if hit.Parent.Humanoid then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local char = plr.Character
local humanoid = char:FindFirstChild('Humanoid')
if humanoid then
local mm = model:Clone()
mm.Parent = workspace
mm:MoveTo(Vector3.new(somewhere over the rainbow)
end
end
end

script.Parent.Touched:connect(onTouch)
Report Abuse
DevObject is not online. DevObject
Joined: 28 Jul 2011
Total Posts: 7048
26 Sep 2016 08:29 AM
When the model is cloned, does it clone in the same spot as the old model?

Basically I'm trying to make an infinite hallway, and a section of the hallway clones each time a part in the model is touched.


Lol'd >Add 5k posts, R.I.P. ROBLOXBaseWarsFPS1
Report Abuse
LockFocus is not online. LockFocus
Joined: 31 Aug 2013
Total Posts: 1044
26 Sep 2016 08:30 AM
not if you set the pos
Report Abuse
DevObject is not online. DevObject
Joined: 28 Jul 2011
Total Posts: 7048
26 Sep 2016 08:31 AM
How would I go about doing this then?


Lol'd >Add 5k posts, R.I.P. ROBLOXBaseWarsFPS1
Report Abuse
LockFocus is not online. LockFocus
Joined: 31 Aug 2013
Total Posts: 1044
26 Sep 2016 08:33 AM
so I would set a primary part.
and then do this thingy I guess.

local lastHall = woohoo
local newH = lastHall:Clone()
newH.Parent = game.Workspace
newH:MoveTo(Vector3.new(lastHall.Position + lengthOfHallway))

obviously you'll need to add more though, but you get the idea.
if the hallway was 5 studs it'd be lastHall.Position + Vector3.new(0, 0, 5)
Report Abuse
DevObject is not online. DevObject
Joined: 28 Jul 2011
Total Posts: 7048
26 Sep 2016 08:36 AM
Oh okay, thanks :) I will try


Lol'd >Add 5k posts, R.I.P. ROBLOXBaseWarsFPS1
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