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

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

Asked by
PropzFx 27
5 years ago

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

Log in to vote
1
Answered by
aazkao 787 Moderation Voter
5 years ago
Edited 5 years ago

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

Ad

Answer this question