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
 

Prevent a player from leaving a seat?!

Previous Thread :: Next Thread 
koenman is not online. koenman
Joined: 15 Jun 2009
Total Posts: 108
06 Jun 2012 03:08 PM
Does anyone know a way to prevent a player get out of a seat?
I want that the player is stuck in a vehicle seat.
Does anyone know how to do this?
My apoligies for my bad english.
Thanks for reading, hope we will find out.

sincerely,
Koenman
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
06 Jun 2012 03:14 PM
Use the seated event, then anchor their torso.
Report Abuse
koenman is not online. koenman
Joined: 15 Jun 2009
Total Posts: 108
06 Jun 2012 03:33 PM
But then the player wont be able the vehicle isn't it?
Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
06 Jun 2012 03:48 PM
You make be able to weld their torso to the seat.

~Read Between The Squiggles~
Report Abuse
koenman is not online. koenman
Joined: 15 Jun 2009
Total Posts: 108
06 Jun 2012 03:52 PM
Good idea, I will try it.
Report Abuse
koenman is not online. koenman
Joined: 15 Jun 2009
Total Posts: 108
06 Jun 2012 04:03 PM
How would i do this?
Report Abuse
killjoy37 is not online. killjoy37
Joined: 27 Aug 2008
Total Posts: 2821
06 Jun 2012 04:04 PM
Instead, just put a kill brick above their head so if they jump out, they die. :D
Just kidding, don't do that.
Report Abuse
koenman is not online. koenman
Joined: 15 Jun 2009
Total Posts: 108
06 Jun 2012 04:05 PM
lol xD
Report Abuse
monkeysmouth is not online. monkeysmouth
Joined: 10 Feb 2011
Total Posts: 493
06 Jun 2012 04:39 PM
use the seated event to weld their legs to the chair
Report Abuse
CrasyTrex is not online. CrasyTrex
Joined: 13 Mar 2011
Total Posts: 761
06 Jun 2012 04:47 PM
Or mabye make it so they can't jump?
script.Parent.Touched:connect(function (hit)
if hit and hit.Parent then
if game.Players:FindFirstChild(hit.Parent.Name) then
if hit.Parent.Humanoid.Health ~= 100 then
repeat hit.Parent.Humanoid.Jump = false until hit.Parent.Humanoid.Health = 0
end
end
end
end)
Report Abuse
koenman is not online. koenman
Joined: 15 Jun 2009
Total Posts: 108
07 Jun 2012 02:12 AM
Doesn't work for me.
Report Abuse
koenman is not online. koenman
Joined: 15 Jun 2009
Total Posts: 108
07 Jun 2012 07:16 AM
Anybody has a idea?
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
07 Jun 2012 07:33 AM
Sure.

This one breaks your character, and then breaks itself, making for some humourous results!

seat = script.Parent

seat.ChildAdded:connect(function(c)
if c.ClassName == "Weld" then

local h = c.Part1
local w = Instance.new("Weld", seat)
w.Part0 = seat
w.Part1 = h.Parent.Head
w.C0 = CFrame.new( Vector3.new(0,20,0) )
w.C1 = CFrame.new()
end
end)


Give me a sec and I'll go fix it xD
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
07 Jun 2012 07:51 AM
NOPE it just got worse D:

seat = script.Parent

seat.ChildAdded:connect(function(c)
if c.Name== "SeatWeld" then

local h = c.Part1
local p = h.Parent.Head.Position - c.Part0.Position
w = Instance.new("Weld", seat)
w.Part0 = seat
w.Part1 = h.Parent["Left Leg"]
w.C0 = CFrame.new(p)
w.C1 = CFrame.new()
end
end)

seat.ChildRemoved:connect(function(c)
if w then w:Destroy()
end
end)


I've concluded welding doesn't help, be it the torso, head, or leg.

Actually I remember helping a guy out with the exact same problem last year...I'll be back in a tick


Here, catch this script.


seat = script.Parent
allowedToJump = false

seat.ChildAdded:connect(function(c)
if c.Name== "SeatWeld" then
local h = c.Part1.Parent:FindFirstChild("Humanoid")
repeat wait() h.Jump = false until allowedToJump
end
end)



It is pretty brutal in the sense that it resets the .Jump value on the player's humanoid to false every 0.03 of a second (or close to)

That's the only way I've been able to do it. Enjoy.
Report Abuse
koenman is not online. koenman
Joined: 15 Jun 2009
Total Posts: 108
08 Jun 2012 11:30 AM
Unfortunately that didn't work :(. I think disableling jumping does not work.
Maybe another way?
Report Abuse
SilverNinja14 is not online. SilverNinja14
Joined: 16 Mar 2010
Total Posts: 1038
08 Jun 2012 06:51 PM
When the torso to seat weld is removed (exiting seat) clone the weld and replace it. I'm not sure if that would work.
Report Abuse
koenman is not online. koenman
Joined: 15 Jun 2009
Total Posts: 108
09 Jun 2012 10:50 AM
Tried to make something that does that.
But it didn't work. Maybe one of you guys can fix it?


function onChildAdded(child)
if child.Name == "SeatWeld" then
if child.Part1.Name == "Torso" then
player = child.Part1.Parent
weld = child:clone()
weld.Parent = script
print("Weld was cloned.")
end
end
end

function onChildRemoved()
if player.Humanoid.Jump == true then
player.Humanoid.sit = true
replaceweld = weld:clone()
replaceweld.Parent = script.Parent
print("Human tried to leave the seat, Replacing human.")
else
print("Human escaped.")
end
end

script.Parent.ChildAdded:connect(onChildAdded)
script.Parent.ChildRemoved:connect(onChildRemoved)
Report Abuse
killjoy37 is not online. killjoy37
Joined: 27 Aug 2008
Total Posts: 2821
09 Jun 2012 11:49 AM
Perhaps my ghetto idea was not so bad after all.
Report Abuse
koenman is not online. koenman
Joined: 15 Jun 2009
Total Posts: 108
09 Jun 2012 12:53 PM
xD. That won't be such a good idea.
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
09 Jun 2012 01:05 PM
Wait I think I know. So inside the player humanoid there is a jump property. Just make a script that is activated when the local human sits in the chair, then it makes the property always = false no matter what.
Report Abuse
koenman is not online. koenman
Joined: 15 Jun 2009
Total Posts: 108
09 Jun 2012 01:22 PM
Already tryed that, it doesn't work.
Report Abuse
BrockRocksYourSocks is not online. BrockRocksYourSocks
Joined: 22 Nov 2009
Total Posts: 5338
09 Jun 2012 01:49 PM
[ Content Deleted ]
Report Abuse
koenman is not online. koenman
Joined: 15 Jun 2009
Total Posts: 108
09 Jun 2012 01:53 PM
But if i do that, will you still be able to drive a vehicle without using a tool?
Report Abuse
koenman is not online. koenman
Joined: 15 Jun 2009
Total Posts: 108
09 Jun 2012 01:59 PM
function onChildAdded(child)
if child.Name == "SeatWeld" then
if child.Part1.Name == "Torso" then
player = child.Part1.Parent
weld = child:clone()
print("Weld was cloned.")
end
end
end

function onChildRemoved()
if player ~= nil then
if player.Humanoid.Jump == true then
player.Humanoid.Sit = true
replaceweld = weld:clone()
replaceweld.Parent = script.Parent
print("Human tried to leave the seat, Replacing human.")
else
print("Human escaped.")
end
end
end

script.Parent.ChildAdded:connect(onChildAdded)
script.Parent.ChildRemoved:connect(onChildRemoved)
________________________________________________________
Didn't work either - Workspace.Car.Sear.Script:15: attempt to index global 'weld' (a nil value)
Report Abuse
koenman is not online. koenman
Joined: 15 Jun 2009
Total Posts: 108
10 Jun 2012 04:46 AM
Bump?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 2Go to page: [1], 2 Next
 
 
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