generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Force a player to sit in a VehicleSeat seat

Previous Thread :: Next Thread 
DarkBeemo is not online. DarkBeemo
Joined: 11 Dec 2012
Total Posts: 80
30 Oct 2014 11:20 AM
~~~~~~~~~~~~~~~~~
function module:CarSpawn(player,Pos,par)
wait()
local car
local val = player:WaitForChild("Values")
local kt = val:WaitForChild("KartChosen")

repeat wait() until (carModels:FindFirstChild(val.KartChosen.Value))
car = carModels:FindFirstChild(val.KartChosen.Value):Clone()

--anchor(car,true,true,"VehicleSeat")
local center = car:GetModelCFrame()
TransformObjects(car:GetChildren(),center,Pos +Vector3.new(0, (car:GetExtentsSize().Y /2) + 1,0),true)

car:MakeJoints() wait()

repeat wait() until player.Character
repeat wait() until player.Character.Torso


player.Character.Humanoid.WalkSpeed = 0
car.Parent=par car:MakeJoints()
Instance.new("Model",car).Name = "DestoryOnLeave"
--player.Character.Torso.CFrame = car.VehicleSeat.CFrame + Vector3.new(0,car:GetExtentsSize().Y + 1 ,0)

local Xeld = Instance.new("Weld",car.VehicleSeat) -- makes a weld
Xeld.Name = "SeatWeld"
Xeld.Part0,Xeld.Part1 = Xeld.Parent, player.Character.HumanoidRootPart -- welds the parts
player.Character.Humanoid.Sit = true -- makes the player sit
Xeld.C0,Xeld.C1 = CFrame.new( 0, 0.6, 0, 1, 0, -0, 0, 0, 1, 0, -1, -0),CFrame.new(0, -1.5, 0, 1, 0, -0, 0, 0, 1, 0, -1, -0)
--Aujust the positions.




return car

end
~~~~~~~~~~~~~~~~~

Thats the code, All works as expected aparting from welding the player to the seat.
~~~~~~~~~~~~~~~~~
local Xeld = Instance.new("Weld",car.VehicleSeat) -- makes a weld
Xeld.Name = "SeatWeld"
Xeld.Part0,Xeld.Part1 = Xeld.Parent, player.Character.HumanoidRootPart -- welds the parts
player.Character.Humanoid.Sit = true -- makes the player sit
Xeld.C0,Xeld.C1 = CFrame.new( 0, 0.6, 0, 1, 0, -0, 0, 0, 1, 0, -1, -0),CFrame.new(0, -1.5, 0, 1, 0, -0, 0, 0, 1, 0, -1, -0)
--Aujust the positions
~~~~~~~~~~~~~~~~~
The exact code "sniped" that dose not work as expected.

simple flowCh:
CarSpawns -- works
Player gets tp'ed to car -- works

But I can drive it. My character just goes everywhere
Report Abuse
DarkBeemo is not online. DarkBeemo
Joined: 11 Dec 2012
Total Posts: 80
30 Oct 2014 01:44 PM
Anyone?
Report Abuse
DarkBeemo is not online. DarkBeemo
Joined: 11 Dec 2012
Total Posts: 80
31 Oct 2014 04:07 AM
Bump
Report Abuse
DarkBeemo is not online. DarkBeemo
Joined: 11 Dec 2012
Total Posts: 80
01 Nov 2014 06:14 AM
Bump
Report Abuse
DarkBeemo is not online. DarkBeemo
Joined: 11 Dec 2012
Total Posts: 80
03 Nov 2014 11:00 AM
Bump
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image