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

Is there a way to tween a Humanoid and all of its parts to another humanoid? [Still unsolved]

Asked by 4 years ago
Edited 4 years ago

I do not want to just Teleport, more like I want to swiftly noclip through my map and reach coordinates, but cant seem to do it! Here is my current code:

wait(3)
local you = game.Players.LocalPlayer.Character:GetChildren()
local target = game.Workspace["target"].HumanoidRootPart.Position
    for i,v in pairs(you) do
    v.CanCollide = false
    game.Players.LocalPlayer.Character.Humanoid:ChangeState(10)
    v.Position = v.Position + Vector3.new(.01,.01,.01)
end

I have also tried just MoveTo, and high walkspeeds, simply wont work, and would just be an autowalk to the location, any help will do, thanks.

EDIT: Also, my old code was a repeat until hit the coordinates, but no matter the code it either flings me, or just walks there.

EDIT #2: New script:

repeat wait() until game.Loaded
local you = game.Players.LocalPlayer.Character
local humanoid = you.Humanoid
local target = Vector3.new(-30.91, 27.05, -89.3)
local model = you:GetChildren()
local apples ={}

for i=1,#model do
   if model[i].Name == "LowerTorso" or model[i].Name == "UpperTorso" then
   table.insert(apples, model[i])
   end
end

for i=1,#model do
   if model[i].Name == "Head" or model[i].Name == "HumanoidRootPart" then
   table.insert(apples, model[i])
   end
end

repeat
    wait()
    humanoid.WalkSpeed = 150
    humanoid:ChangeState(18)
    humanoid:MoveTo(target)
    for i,v in pairs(apples) do
        v.CanCollide = false
        print(i)
        print(v)
    end
until you.UpperTorso.Position == target

1 answer

Log in to vote
0
Answered by
SnowieDev 171
4 years ago
Edited 4 years ago

Put this in a ServerScript and put the ServerScript in your wanted ActivatorPad. If you want to transport them right when they spawn in then you should put the ServerScript in a spawnlocation.

I know I didn't explain why this is the solution because I'm not good at describing and I'm not good at teaching. But I hoped this helped.

local target = CFrame.new(-30.91, 27.05, -89.3)

local TweenService = game:GetService("TweenService")
local TweenInformation = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
local Goal = {CFrame = target}

script.Parent.Touched:Connect(function(Hit)
    if Hit.Parent:FindFirstChild("Humanoid") then
        print("Found Player")
        local HumanoidRootPart = Hit.Parent:WaitForChild("HumanoidRootPart")
        HumanoidRootPart.Anchored = true
        local Transport = TweenService:Create(HumanoidRootPart, TweenInformation, Goal)
        Transport:Play()
        Transport.Completed:Connect(function()
            HumanoidRootPart.Anchored = false
        end)
    end
end)

Ad

Answer this question