Categories > Coding > Lua >
Why is my Lua script not working, Making a tween service for roblox to bypass teleport
Posted
Cancel
Post
Replied
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
player.CharacterAdded:Wait()
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")
local tweenInfo = TweenInfo.new(3, Enum.EasingStyle.Linear)
local goal = {
CFrame = CFrame.new(
-291.390808, 18.2636929, 1597.67761,
0.467862487, -8.63611689e-08, 0.883801281,
7.26185547e-08, 1, 5.9273134e-08,
-0.883801281, 3.64486965e-08, 0.467862487
)
}
local teleportTween = TweenService:Create(hrp, tweenInfo, goal)
teleportTween:Play()
Cancel
Post
Added
-- === SETTINGS ===
local helicopter = workspace:FindFirstChild("Helicopter") -- replace with actual name
local crate = workspace:FindFirstChild("CargoCrate") -- replace with actual name
-- === VALIDATION ===
if not helicopter or not crate then
warn("Helicopter or CargoCrate not found.")
return
end
local heliPart = helicopter:FindFirstChildWhichIsA("BasePart")
local cratePart = crate:FindFirstChildWhichIsA("BasePart")
if not heliPart or not cratePart then
warn("Missing parts for rope.")
return
end
-- === CREATE ATTACHMENTS ===
local heliAttach = Instance.new("Attachment", heliPart)
heliAttach.Name = "HeliAttachment"
local crateAttach = Instance.new("Attachment", cratePart)
crateAttach.Name = "CrateAttachment"
-- === CREATE ROPE ===
local rope = Instance.new("RopeConstraint")
rope.Attachment0 = heliAttach
rope.Attachment1 = crateAttach
rope.Length = (heliAttach.WorldPosition - crateAttach.WorldPosition).Magnitude
rope.Visible = true
rope.Restitution = 0.1
rope.WinchEnabled = true
rope.WinchSpeed = 10
rope.Parent = heliPart
-- === OPTIONAL: WELD CRATE TO HELI ===
local weld = Instance.new("WeldConstraint")
weld.Part0 = cratePart
weld.Part1 = heliPart
weld.Parent = cratePart
-- === OPTIONAL: LIFT HELI WITH CFrame (may lag if physics owned by server) ===
task.spawn(function()
local height = 50
local steps = 50
for i = 1, steps do
heliPart.CFrame = heliPart.CFrame + Vector3.new(0, height / steps, 0)
task.wait(0.05)
end
end)
Cancel
Post
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Comments
zlpvh 0 Reputation
Commented
is there any way to make it stop lagging, Im firing server to spawn a car, and it flys to the location i want but it keeps lagging back, if this is too much hassle how would i make it easier by connecting a rope to a cargo ship in jailbreak, how would i connect the rope, there is a ropeconstraint and and weld and RopePull im trying to connect the ropepull to the cargo box and make it auto rob
0