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

Why Does Part Move to (0,0,0) after changing its Angle CFrame? [Solved] by vissequ

Asked by
Fad99 286 Moderation Voter
5 years ago
Edited 5 years ago

Im Trying to change the angle when the part gets touched but why does the part move to (0,0,0) Note: The part is NoCollide and Anchored is that helps

Script:

local dad = script.Parent
local Light = Instance.new("PointLight")
Light.Color = dad.Color
local i = 0
local OgPos = dad.Position

dad.Touched:Connect(function(p)
    local pp = p.Parent

    if game.Players:GetPlayerFromCharacter(pp) then
        i = i + 25
        dad.CFrame = CFrame.new(OgPos) --// I tried this to counteract problem but there was no diffrence
        dad.CFrame = CFrame.Angles(i/2,i,i*3)
    end
end)
0
I think you need to have it be like dad.CFrame = dad.CFrame * CFrame.Angles vissequ 105 — 5y
0
CFrame is used to move an object instead use dad.Angle = angle here Gameplayer365247v2 1055 — 5y
0
Don't use Gameplayer's suggestion Angle is not a valid member of dad. BlackOrange3343 2676 — 5y
0
Thanks vissequ, it help me out a ton!!! Fad99 286 — 5y

1 answer

Log in to vote
0
Answered by
xg1y 41
5 years ago
local dad = script.Parent
local Light = Instance.new("PointLight")
Light.Color = dad.Color
local i = 0
local OgPos = dad.Position



dad.Touched:Connect(function(p)
local pp = p.Parent


if game.Players:GetPlayerFromCharacter(pp) then

i = i + 25

local Pos = Vector3.new(dad.Position.X,dad.Position.Y,dad.Position.Z)
local Orientation = Vector3.new(i/2,i,i*3)
dad.CFrame = CFrame.new(Pos,Orientation)

end
end)

I don't know if this helps but :shrug:

0
This Script does do what i wanted but it only happens once Fad99 286 — 5y
0
Then you just gotta make an auto-updater xg1y 41 — 5y
Ad

Answer this question