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: Delete Created Part Upon Deselect

Previous Thread :: Next Thread 
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
17 Feb 2014 11:38 AM
This script works great.. I just can't seem to remove the part after the tool (HopperBin) is deselected, tried various ways, gave up, hoping one of you guys know how to do it lol.

Script so far:

bin = script.Parent
me = script.Parent.Parent.Parent
wepunz = me.Backpack.TerrierPunch

enabled = true

wepunz.Selected:connect(function(mouse)

if not enabled then
return
end

local player = game.Players.LocalPlayer
if player == nil then return end
enabled = false


mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"


leftarm = me.Character:findFirstChild("Torso")
if leftarm ~= nil then

bleh = 2

local p = Instance.new("Part")
p.Parent = leftarm
p.Size = Vector3.new(bleh, bleh, bleh)
p.BrickColor = BrickColor.new("Bright red")
p.Transparency = 0
p.TopSurface = "Smooth"
p.BottomSurface = "Smooth"
p.Shape = "Ball"
a = Instance.new("Fire")
a.Parent = p
a.Heat = 0
a.Size = 5
w = Instance.new("Weld")
w.Part0 = leftarm
w.Part1 = p
w.Parent = leftarm
w.C1 = CFrame.new(0,1,0)*CFrame.Angles(0,0,0)
hax = game.Lighting.TerrierPunch1:clone()
hax.Parent = p
wait(10)

mouse.Icon = "rbxasset://textures\\GunCursor.png"
enabled = true
end
end)
Report Abuse
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
17 Feb 2014 11:55 AM
bump1
Report Abuse
MarioKartAddict is not online. MarioKartAddict
Joined: 11 Nov 2009
Total Posts: 42774
17 Feb 2014 12:06 PM
http://wiki.roblox.com/index.php?title=Deselected
Report Abuse
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
17 Feb 2014 12:20 PM
Yea I tried.

Failed.

Bleh.
Report Abuse
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
17 Feb 2014 12:22 PM
Reason I failed - (excerpt)

bin = script.Parent
me = script.Parent.Parent.Parent
wepunz = me.Backpack.TerrierPunch
players = game:GetService("Players")
realme = players:FindFirstChild(me)

wepunz.Deselected:connect(function(mouse)
game.Workspace.realme.Torso.Philberto:Remove() --[[realme is not a valid member of workspace]]
end)
Report Abuse
MarioKartAddict is not online. MarioKartAddict
Joined: 11 Nov 2009
Total Posts: 42774
17 Feb 2014 12:23 PM
game.Workspace:findFirstChild(realme).Torso.Philberto:Remove()
Report Abuse
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
17 Feb 2014 12:23 PM
Philberto refuses to go away.


Yes the parts name IS Philberto, I changed the above originally posted script since it's been posted to name the part Philberto.
Report Abuse
MarioKartAddict is not online. MarioKartAddict
Joined: 11 Nov 2009
Total Posts: 42774
17 Feb 2014 12:24 PM
:Destroy()*

my bad, :Remove() is deprecated
Report Abuse
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
17 Feb 2014 12:31 PM
Philberto is still sticking around q-q

Output

13:30:37.457 - Argument 1 missing or nil
13:30:37.458 - Script 'Players.Player3.Backpack.TerrierPunch.Script', Line 8
13:30:37.460 - stack end


bin = script.Parent
me = script.Parent.Parent.Parent
wepunz = me.Backpack.TerrierPunch
players = game:GetService("Players")
realme = players:findFirstChild(me)

wepunz.Deselected:connect(function(mouse)
game.Workspace:findFirstChild(realme).Torso.Philberto:Destroy()
end)
Report Abuse
MarioKartAddict is not online. MarioKartAddict
Joined: 11 Nov 2009
Total Posts: 42774
17 Feb 2014 12:37 PM
bin = script.Parent
me = script.Parent.Parent.Parent
wepunz = me.Backpack.TerrierPunch

wepunz.Deselected:connect(function(mouse)
me.Character.Torso.Philberto:Destroy()
end)


-- I think this works
Report Abuse
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
17 Feb 2014 01:13 PM
It DOES work...

However... it only works once. :/
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