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

[Solved] Why do i get an error "TranslateBy is not a valid member of Part"?

Asked by 4 years ago
Edited 4 years ago

Code:

01local Car = game.Workspace.Car
02local Seats = game.Workspace.Car.Seats:GetChildren() -- Locates the Group of seats in your car
03local Gui = script.Parent:FindFirstChild("ExitButton") -- Locates the Exit Button in the Teleport Part
04local Gui2 = script.Parent:FindFirstChild("LoadingScreen") -- Locates the Exit Button in the Teleport Part
05 
06script.Parent.Touched:Connect(function(hit)
07    if hit.Parent:FindFirstChild("Humanoid") then
08        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
09            for i,v in pairs(Seats) do
10                if Seats.Occupant == nil then
11                hit.Parent.Humanoid.JumpPower = 0
12                hit.Parent.Humanoid.WalkSpeed = 0
13                Gui:Clone().Parent = player.PlayerGui
14                player.Character.HumanoidRootPart.CFrame = Seats[math.random(1,12)].CFrame -- Teleports the player to a vacant seat
15                wait(10)
View all 44 lines...

workspace:https://imgur.com/a/kCDGcVR

I watched this vid as a tut: https://www.youtube.com/watch?v=27nHlMvmbek

1 answer

Log in to vote
0
Answered by 4 years ago

Fixed it, the car had to be a model / group not a part

Ad

Answer this question