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

How do i make a part not change position when i touch it?

How do i make a part not change position when i touch it? I have tried like everything. When a part is moving and a player or a object front of it, it automatic jumps on top on the player/object

Heres the code im working on. Everything works without that the laser moves ontop of the players head and then back to the normal position

lock = false
game.ReplicatedStorage.LaserJumpEvent.Event:Connect(function()
	if lock == false then
		lock = true
		while lock do
		local laser1 = script.Parent
laser1.Position =Vector3.new(-143.6, 14.5, -115.5)

local laserSpeed1 = math.random(3,6)
local laserDelay1 = math.random(1,3)
local waitTime = laserDelay1 + laserSpeed1 * 2

local tweenService = game:GetService("TweenService")

local tweenInfo1 = TweenInfo.new(
	
	laserSpeed1,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.In,
	0,
	true,
	laserDelay1
)

local tween1Start = tweenService:Create(laser1, tweenInfo1, {Position = Vector3.new(-143.6, 14.5, -234.5)})
tween1Start:Play()

wait(waitTime)
end
	else
		lock = false
	end
end)

1 answer

✓ Accepted answer

You have to use CFrame in your Tweening, Vector3 will always "round" its position till its not touching anything if the object touches something while changing its position

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