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 » Scripters
Home Search
 

Re: Need a script.

Previous Thread :: Next Thread 
xboy1999 is not online. xboy1999
Joined: 25 Jan 2011
Total Posts: 29
10 May 2016 09:01 PM
Hi all, I'm in need of a script that can delete a certain model anywhere in the game from walking/touching (Not clicking) onto a button. If you can't help, but know of someone who can please point me in their direction!


-Xboy
Report Abuse
minerioProgramer is not online. minerioProgramer
Joined: 21 Dec 2012
Total Posts: 432
10 May 2016 09:09 PM
It's actually really easy to script. Let me give you some pointers:
game.Workspace.Anymodel:remove() --removes the model called Anymodel

Use the code in this wiki for contacting with bricks:
http://wiki.roblox.com/index.php?title=Lighting_Parts_on_Fire

That's all you need to know.
Report Abuse
xboy1999 is not online. xboy1999
Joined: 25 Jan 2011
Total Posts: 29
10 May 2016 10:20 PM
Thank you. This did help some, but I am having some trouble putting my part into the equation as its buried deep inside my game and models any advice?


Report Abuse
Wowgnomes is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
10 May 2016 10:33 PM
yeah put the script in the model ur removing and have it remove script.Parent and function when game.workspace.bricknamehere is touched


Report Abuse
scottmike0 is not online. scottmike0
Joined: 14 Sep 2008
Total Posts: 1073
10 May 2016 10:58 PM
deleting a specific model in the game, or a random model?
Report Abuse
xboy1999 is not online. xboy1999
Joined: 25 Jan 2011
Total Posts: 29
11 May 2016 01:57 PM
Its a specific model heres my script so far:

function removepart(part)
print("Going to delete this part:")
print(part.Name)

game.Workspace.["Xboy's Tycoon Kit"].Tycoons.["Red Clasher"].PurchasedObjects.Lvl1:remove() --removes the model called Anymodel
end

touchedPart = game.Workspace.["Xboy's Tycoon Kit"].Tycoons.["Red Clasher"].Buttons.["Buy TH1 - $300"].Head
touchedPart.Touched:connect(removepart)



A smart man makes a mistake, learns from it, and never makes that mistake again. But a wise man finds a smart man and learns from him how to avoid the mistake altogether.
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
11 May 2016 02:00 PM
:Destroy() is generally better then :remove() from what I've heard.


~~~Da siggy is OP~~~
Report Abuse
xboy1999 is not online. xboy1999
Joined: 25 Jan 2011
Total Posts: 29
11 May 2016 02:11 PM
I could do that but my issue is still trying to put the names inside the string.


game.Workspace.["Xboy's Tycoon Kit"].Tycoons.["Red Clasher"].PurchasedObjects.Lvl1:Destroy()

Do I need to Eliminate all the spaces in between the names of my models?

The part is inside my tycoon kit (Ex. "Xboy's Tycoon Kit") then a model called "Tycoons" then another one called "Red Clasher", then PurchasedObjects and then the actual part. But whenever I try to use the script I posted it just comes up with an error: "Error: (5,16) Expected Identifier, got '[' "

I don't know if this contributes to the problem or not, but "Lvl1" that I'm trying to Remove is an Model with parts in it.


A smart man makes a mistake, learns from it, and never makes that mistake again. But a wise man finds a smart man and learns from him how to avoid the mistake altogether.
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
11 May 2016 02:14 PM
game.Workspace["Xboy's Tycoon Kit"].Tycoons["Red Clasher"].Buttons["Buy TH1 - $300"].Head.Touched:connect(function removepart(part)
game.Workspace["Xboy's Tycoon Kit"].Tycoons["Red Clasher"].PurchasedObjects.Lvl1:remove()
end)


~~~Da siggy is OP~~~
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
11 May 2016 02:14 PM
That's your whole script there reduced to three lines.


~~~Da siggy is OP~~~
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
11 May 2016 02:15 PM
Also I would use Destroy but remove would also work fine here.

game.Workspace["Xboy's Tycoon Kit"].Tycoons["Red Clasher"].Buttons["Buy TH1 - $300"].Head.Touched:connect(function removepart(part)
game.Workspace["Xboy's Tycoon Kit"].Tycoons["Red Clasher"].PurchasedObjects.Lvl1:Destroy()
end)


~~~Da siggy is OP~~~
Report Abuse
xboy1999 is not online. xboy1999
Joined: 25 Jan 2011
Total Posts: 29
11 May 2016 02:20 PM
Thank you for shortening it, but it still doesn't work. It now gives this error:
"Error: (1,116) Expected '(' got 'removepart' " Pertaining to this:

game.Workspace["Xboy's Tycoon Kit"].Tycoons["Red Clasher"].Buttons["Buy TH1 - $300"].Head.Touched:connect(function removepart(part)
~~This right here ^^^^^^^^^^



game.Workspace["Xboy's Tycoon Kit"].Tycoons["Red Clasher"].PurchasedObjects.Lvl1:Destroy()
end)


A smart man makes a mistake, learns from it, and never makes that mistake again. But a wise man finds a smart man and learns from him how to avoid the mistake altogether.
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
11 May 2016 02:21 PM
game.Workspace["Xboy's Tycoon Kit"].Tycoons["Red Clasher"].Buttons["Buy TH1 - $300"].Head.Touched:connect(function (part)
game.Workspace["Xboy's Tycoon Kit"].Tycoons["Red Clasher"].PurchasedObjects.Lvl1:Destroy()
end)


~~~Da siggy is OP~~~
Report Abuse
xboy1999 is not online. xboy1999
Joined: 25 Jan 2011
Total Posts: 29
11 May 2016 02:28 PM
I'm an idiot...

Thank you for helping me through my phase of ignorance..

Here's the finished script:

script.Parent.Touched:connect(function (part)
game.Workspace["Xboy's Tycoon Kit"].Tycoons["Red Clasher"].PurchasedObjects.Lvl1:Destroy()
end)


A smart man makes a mistake, learns from it, and never makes that mistake again. But a wise man finds a smart man and learns from him how to avoid the mistake altogether.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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