local part = game.Workspace.Tracks local cloned = part:Clone() cloned.Parent = game.Workspace
function hit () cloned.position = Vector3.new(0,0,0) end
script.Parent.Touched:connect(hit)
whenever i do this, i get the error "position is not a valid member of model" I know what this is saying, but how do I get around this?
You simply are forgetting that models don't have Position
. Position is capitalized. Either put a block inside of the model and move that, or put a block inside the model and make it the primary part and move that. You should also not that :connect()
is deprecated. Use :Connect()
instead. To post code, all you need to do is place the code inside of the two lines that are provided. Example (imagine the ' are the lines provided when you click the code block button):
'''''''''''''''''
-- code
'''''''''''''''''
Here we use the real method with your fixed script:
local part = game.Workspace.Tracks local cloned = part:Clone() cloned.Parent = game.Workspace local function hit() -- it is recommended that you localize your functions cloned.position = Vector3.new(0,0,0) end script.Parent.Touched:Connect(hit)
Info on localizing your functions here. If you have any additional questions feel free to post them in the comments below. I hope I helped and have a great day scripting!
local part = game.Workspace.Tracks local cloned = part:Clone() cloned.Parent = game.Workspace function Hit() cloned.Position = CFrame.new(0,0,0) -- Use CFrame instead of Vector3 end script.Parent.Touched:Connect(Hit) -- Use :Connect() instead of :connect()