#need help for my moving meshpart

1 messages · Page 1 of 1 (latest)

novel sage
#

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("LaunchNukeEvent")

local TweenService = game:GetService("TweenService")

event.OnServerEvent:Connect(function(player)
local rocket = workspace:FindFirstChild("Nuke")
local part1 = workspace:FindFirstChild("part1")
local part2 = workspace:FindFirstChild("part2")
local part3 = workspace:FindFirstChild("part3")
local part4 = workspace:FindFirstChild("part4")

if not (rocket and part1 and part2 and part3 and part4) then
    warn("Etwas fehlt im Workspace!")
    return
end

local function moveRocket(targetPart, duration, rotationDelta)
    local goal = {}
    goal.CFrame = CFrame.new(targetPart.Position) * CFrame.Angles(0, math.rad(rotationDelta), 0)

    local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Linear)
    local tween = TweenService:Create(rocket, tweenInfo, goal)
    tween:Play()
    tween.Completed:Wait()
end

-- Bewegung & Rotation
moveRocket(part1, 2, 30)
moveRocket(part2, 2, 0)
moveRocket(part3, 2, 10)
moveRocket(part4, 2, 60)

-- In Part 4 reingeflogen – nach 2 Sekunden verschwinden
wait(2)
rocket:Destroy()

end)

#

this is my script but for any reason the mesh doesnt rotate

opal harbor
#

try cframe.fromeulerangles

#

i'm not sure if the parts sides are equal so, maybe try x or z