Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Using Vector3 doesn't makes my part on the right position?

Asked by 6 years ago
Edited 6 years ago

I have this button that is supposed to resize and reposition a part. But a problem I have a lot is that vector3.new and tweening can't have a part in a position if there is other parts in the way.

Not Anchored - Not wrong position sat - Checked many times

Script:

click = script.Parent.ClickDetector
local Giver = script.Parent.Parent.Parent.Giver
local av = false

function wat(player)
        if av == true then
            av = false
            Giver.Position = Vector3.new(9.774, 0.825, -6.403)
            Giver.Size = Vector3.new(1.57, 0.25, 4.11)
            Giver.Transparency = 0.2
            script.Parent.BrickColor = BrickColor.new('Really red')
            script.Parent.Parent.Main.SurfaceGui.Frame.TextLabel.Text = "AUTO COLLECTER          OFF"
        elseif av == false then
            av = true
            Giver.Position = Vector3.new(6.18, 0.722, -38.968)
            Giver.Size = Vector3.new(191.59, 0.05, 159.38)
            Giver.Transparency = 1
            script.Parent.BrickColor = BrickColor.new('Lime green')
            script.Parent.Parent.Main.SurfaceGui.Frame.TextLabel.Text = "AUTO COLLECTER          ON"
        end
    end

click.MouseClick:connect(wat)

0
I don't know the technicalities as to why Vector3s cannot go through Parts but to do what you want, use CFrames instead. PreciseLogic 271 — 6y
0
Thx, I thing I used Cframes at a time because it didn't worked but the script is removed so couldn't remember. MineJulRBX 52 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

use CFrame to have a part be able to be in a certain position without physics getting in the way also I would reccomend making the part anchored if you want it to be inside a different part otherwise the physiscs will influence it. good luck

Ad

Answer this question