Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how do i make the part go in the right place?

local split = v.Position.Value:split(", ")
local numbervalue = Vector3.new(tonumber(split[1]),tonumber(split[2]),tonumber(split[3]))
local distance = tostring(bases.Position - numbervalue)

first line holds a part's position inside a string value, that way i can save the value (ive tried with saving vector3 but wont work) numbervalue is the vector3 value of split distance is the actual base position - the number value (1 vector3 - another vector3) do anyone know why this wont save so that next time when i load it in to the part, the part goes in the right place? this is my script where i place the part

local position = base_values.Position.Value:split(", ")--this the distance stored as a string value
local x = tonumber(position[1])--these 3 is of course me making the 3 numbers into tonumbers
local y = tonumber(position[2])
local z = tonumber(position[3])
part.Position = v.Position + Vector3.new(x,y,z)--and here i set the part's position to the base position + those 3 numbers

someone please help me make this work this is how it turns out https://imgur.com/a/sB9LQ0z

1 answer

#I think you might want to do this:

-- this part is the same
local split = v.Position.Value:split(", ")
local numbervalue = Vector3.new(tonumber(split[1]),tonumber(split[2]),tonumber(split[3]))
local distance = tostring(bases.Position - numbervalue)

Problem

when you go to change the part, you are taking the current position so say (1, 2 , 3) and you add (1 , 2 ,3) to it, now you have (2,4,6) instead of (1 , 2 ,3).

Solution

instead of adding the new value, just change it to the new value. So here is what i changed

part.Position =  Vector3.new(x,y,z) -- make it equal to the new vector3

1 comment

0

this moved the part a little bit closer but not quire there, also this wont work since i need to get the position of whatever base i choose and put the part inside there, this would just put the part in the position that is the distance

This discussion is preserved as it was. New answers, comments, and votes are closed.