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

Welding a player to a CFrame moving part not working?

Asked by 6 years ago

I have a script in a car that moves it foward for a cool cinematic ending. The problem is when I try to make the player seat in the car seat or weld the player to the car it will stay in the same position and I'm not sure what to do..

Car script:

--Some code...
local a = .1
for i = 1,1000 do
    a = a + .01
script.Parent.Parent:SetPrimaryPartCFrame(script.Parent.Parent.Base.CFrame + Vector3.new(0,0,-a))
wait()
end
--Some more code..

Script to weld the player to the car:

local Weld = Instance.new("ManualWeld",game.Workspace:WaitForChild("Car").Seat)
        Weld.Name = "WeldPlayerToCar"
        Weld.Part0 = player.Character.Torso
        Weld.Part1 = game.Workspace.Car.Seat
        Weld.C0 = CFrame.new(game.Workspace.Car.Seat.Position)
                --Creates weld but doesn't move the player along with it.

I apreciate any kindness on helping me solving this annoying problem! ^.^

1 answer

Log in to vote
0
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
6 years ago

You're pretty much welding the car seat to the player, you should try it the other way around. Try this:

local Weld = Instance.new('Weld', workspace:WaitForChild('Car').Seat)
Weld.Name = 'WeldPlayerToCar'
Weld.Part0 = workspace.Car.Seat
weld.Part1 = player.Character.HumanoidRootPart
weld.C0 = CFrame.new(0,3,0)
0
Still didn't work.. I can't just weld parts to other moving parts? wilsonsilva007 373 — 6y
Ad

Answer this question