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

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

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)

4 comments

0

I think you need to have it be like dad.CFrame = dad.CFrame * CFrame.Angles

0

CFrame is used to move an object instead use dad.Angle = angle here

0

Don't use Gameplayer's suggestion Angle is not a valid member of dad.

0

Thanks vissequ, it help me out a ton!!!

1 answer

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:

2 comments

0

This Script does do what i wanted but it only happens once

0

Then you just gotta make an auto-updater

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