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
 

Re: Something I still can't get.

Previous Thread :: Next Thread 
Cjslick is not online. Cjslick
Joined: 11 Jul 2009
Total Posts: 2130
21 Jan 2014 05:29 PM
Hey guys, I have a problem with my tool giving seat, where the tool stays in the inventory if you use the tool. The problem Is I have no idea if i need to make a separate script or tweak the script I already have.

Could someone shed some light on what I would need to do and help me? Of course any help is appreciated.
Report Abuse
ElectricAxel is not online. ElectricAxel
Joined: 15 May 2009
Total Posts: 16239
21 Jan 2014 05:37 PM
Is the tool a tool or a hopperbin? Can we see the seat's script?
Report Abuse
Cjslick is not online. Cjslick
Joined: 11 Jul 2009
Total Posts: 2130
21 Jan 2014 06:48 PM
Tool. (I would have said hopperbin if it was)

Sure thing:
----
position = script.Parent.Position
seat = script.Parent

function onSitUp(child, gui, plane)
if child.Parent == nil then
gui.Parent = script
gui.rmv.Disabled=true
gui.RadarScript.Disabled=true
script.Parent.Locked = false
script.Parent.Parent = game.Workspace
end
end

function onChildAdded(part)
if part.className == "Weld" then
local torso = part.Part1
if torso ~= nil then

local char = torso.Parent
local player = game.Players:GetPlayerFromCharacter(char)
if player ~= nil then
local GUI = game.Lighting.Turret:clone()
GUI.Parent = player.Backpack
part.AncestryChanged:connect(function(child) onSitUp(child, GUI, script.Parent) end)
end
local parent = torso.Parent
if parent ~= nil then
script.Parent.Locked = true
script.Parent.Parent = parent
end
end
end
end

seat.ChildAdded:connect(onChildAdded)
----
Report Abuse
ElectricAxel is not online. ElectricAxel
Joined: 15 May 2009
Total Posts: 16239
21 Jan 2014 06:58 PM
This is just a test, I know a different way but the one you had seems fine...

position = script.Parent.Position
seat = script.Parent

function onSitUp(child, gui, plane, part)
wait()
if child.Parent == nil or part == child then
gui:Destroy()
script.Parent.Locked = false
script.Parent.Parent = game.Workspace
end
end

function onChildAdded(part)
if part.className == "Weld" then
local torso = part.Part1
if torso ~= nil then

local char = torso.Parent
local player = game.Players:GetPlayerFromCharacter(char)
if player ~= nil then
local GUI = game.Lighting.Turret:clone()
GUI.Parent = player.Backpack
part.AncestryChanged:connect(function(child) onSitUp(child, GUI, script.Parent, part) end)
end
local parent = torso.Parent
if parent ~= nil then
script.Parent.Locked = true
script.Parent.Parent = parent
end
end
end
end

seat.ChildAdded:connect(onChildAdded)
Report Abuse
Cjslick is not online. Cjslick
Joined: 11 Jul 2009
Total Posts: 2130
21 Jan 2014 07:01 PM
I just realized there's a GUI part, I don't have a GUI to assign. Will that be the glitching part?
Report Abuse
Cjslick is not online. Cjslick
Joined: 11 Jul 2009
Total Posts: 2130
21 Jan 2014 07:06 PM
It gives the tool but immediately takes it away.
Report Abuse
ElectricAxel is not online. ElectricAxel
Joined: 15 May 2009
Total Posts: 16239
21 Jan 2014 07:11 PM
lol I thought it would do that, sorry: (btw, the "gui" is actually the tool, I don't know why its called gui in this case)

position = script.Parent.Position
seat = script.Parent

function onSitUp(child, gui, plane, part)
wait()
if child.Parent == nil and part == child then
gui:Destroy()
script.Parent.Locked = false
script.Parent.Parent = game.Workspace
end
end

function onChildAdded(part)
if part.className == "Weld" then
local torso = part.Part1
if torso ~= nil then

local char = torso.Parent
local player = game.Players:GetPlayerFromCharacter(char)
if player ~= nil then
local GUI = game.Lighting.Turret:clone()
GUI.Parent = player.Backpack
part.AncestryChanged:connect(function(child) onSitUp(child, GUI, script.Parent, part) end)
end
local parent = torso.Parent
if parent ~= nil then
script.Parent.Locked = true
script.Parent.Parent = parent
end
end
end
end

seat.ChildAdded:connect(onChildAdded)
Report Abuse
Cjslick is not online. Cjslick
Joined: 11 Jul 2009
Total Posts: 2130
22 Jan 2014 07:30 AM
Oh. I think the reason for that Is I didn't want to mess with changing the variables, because of the sheer number of times it's stated in this script.

Works great now, just one question about what you altered from the original script.
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