whenever I do script.Parent.Position = Vector3.new(y)-1 or anything like that it errors out saying Y cannot be assigned what am I doing wrong here because when I do script.Parent.Position. I get the ability to pick X, Y, Z but I want to pick y then subtract .5 from it so when it touches the ground the y Value is -.5 of where it would be
heres my script so far
script.Parent.Touched:connect(function(hit) local p = Instance.new("Part", workspace) p.Anchored = true p.Position = script.Parent.Position p.Size = Vector3.new(0.3, 0.3, 0.3) p.Color = Color3.new(0, 0, 0) p.Position.y = Vector3.new(p.Position.y -1) script.Parent:Destroy() end)
You cannot directly edit the members of a multi-member data type such as Vector3 or UDim2, you have to edit it all at once.
Something to keep in mind, though, is that the current value of the property is kept until the line setting the new value is fully interpreted:
p.Position= Vector3.new(p.Position.X, p.Position.Y - 1, p.Position.Z) --or, alternatively: p.Position = p.Position - Vector3.new(0, 1) --any trailing zeroes are automatically filled in for you.
Your line 7 would be:
p.Position = p.Position - Vector3.new(0,0.5,0)
If it were to be .5. There is a Y property of Vector3, but you can't just set the value the way you're attempting.
Thanks for helping me It was starting to annoy me because I couldn't get it to work xD