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: Need Help Modfiying script for a tool

Previous Thread :: Next Thread 
PokemonGuy365 is not online. PokemonGuy365
Joined: 21 Dec 2010
Total Posts: 13482
12 Jun 2012 12:37 AM
I'm trying to do the following witht his script

-Make it Steal an Object (the object is a basketball)
-Every time it touches that object it would do a math problem to that would steal the ball only every so oftne (like 1 out of 50 times or so)

Notes
This would be a tool with a brick labeled steal that would take the oppenets ball

I have taken this steal script out of the Free modeled basketball tool

My Question would be what would need to be modified to make this work inside the brick succesfully

function onTouched(hit)
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
ball.Parent = human.Parent
end
end
connection = ball.Touched:connect(onTouched)
Report Abuse
bananacupcake is not online. bananacupcake
Joined: 15 Jun 2010
Total Posts: 571
12 Jun 2012 12:50 AM
I can't even understand what you're asking. As for the math problem:

x = math.random(1,50)
if x == 12 then
Report Abuse
PokemonGuy365 is not online. PokemonGuy365
Joined: 21 Dec 2010
Total Posts: 13482
12 Jun 2012 12:54 AM
Im trying to make the tool steal or take a antoher brick (speifically a basketball)

I want the script to make a random math problem so where the ball isnt taken every time its only take every so often

Report Abuse
bananacupcake is not online. bananacupcake
Joined: 15 Jun 2010
Total Posts: 571
12 Jun 2012 12:57 AM
What do you mean by 'taken'? Like somebody can pick it up?
Report Abuse
commanderbly8284 is not online. commanderbly8284
Joined: 15 Feb 2009
Total Posts: 2603
12 Jun 2012 01:29 AM
If you have played funbrain there is a game where you play a BBall game and it gives you a math problem so thata you can shoot, so I think he wants a tool that takes the ball and when you take the ball the ball or whatever will give you a math problem that way you don't always have the ball or to shoot.
Report Abuse
PokemonGuy365 is not online. PokemonGuy365
Joined: 21 Dec 2010
Total Posts: 13482
12 Jun 2012 09:49 AM
no no no no no

This is what I mean

The tool is suppose to be a steal tool (its a one brick tool with a free motion arm movement)
I want a script that will tell the brick to steal the basketball, but instead of stealing it everytime I want it to where the ball isn't taken by the tool every time it toches the ball just every so often
Report Abuse
PokemonGuy365 is not online. PokemonGuy365
Joined: 21 Dec 2010
Total Posts: 13482
12 Jun 2012 11:01 AM
Can I get some help with this please
Report Abuse
PurelyRandom is not online. PurelyRandom
Joined: 05 Mar 2011
Total Posts: 36763
12 Jun 2012 11:10 AM
Here is what he means:


Player 1 has Basketball
Player 2 has Steal Tool


Player 2 uses Steal Tool on Player 1, which activates the math script. Let's say he has a 50% chance of success. If he succeeds, he takes the Basketball (Tool) from Player 1. Now Player 1 has to use HIS Steal Tool to take the Basketball back, but let's say he fails. If he tries again, the math script will determine whether he succeeds.

Basically, by 'Steal' or 'Take', he means it literally. He actually means that Player 2 takes the tool away from Player 1.
Report Abuse
PokemonGuy365 is not online. PokemonGuy365
Joined: 21 Dec 2010
Total Posts: 13482
12 Jun 2012 03:19 PM
thank you someone gets it
Report Abuse
PokemonGuy365 is not online. PokemonGuy365
Joined: 21 Dec 2010
Total Posts: 13482
12 Jun 2012 07:43 PM
plz i will pay you if you can help me out on this
Report Abuse
lombardo2 is not online. lombardo2
Joined: 30 Nov 2008
Total Posts: 1604
12 Jun 2012 07:54 PM
Just a warning, we, the scripting helpers HATE to create scripts from scratch, mostly you wont get nothing, but im feeling good today so...

tool.Selected:connect(function(mouse)
mouse.Button1Click:connect(function()
if mouse.Target and mouse.Target:IsA("Model") then
hum = mouse.Target:FindFirstChild("Humanoid")
if hum ~= nil then
for k,v in pairs(mouse.Target:GetChildren()) do
if v:IsA("Tool") then
if chance == 1 then
a = v:Clone()
a.Parent = tool.Parent
v:Remove()
end
end
end
end
end
end)
end)

Probably there are some errors, I cant test is so... try to fix it yourself
Report Abuse
PokemonGuy365 is not online. PokemonGuy365
Joined: 21 Dec 2010
Total Posts: 13482
12 Jun 2012 08:00 PM
thank you
Report Abuse
lombardo2 is not online. lombardo2
Joined: 30 Nov 2008
Total Posts: 1604
12 Jun 2012 08:12 PM
Oh xD my bad sorry, forgot copy-paste variables XD

tool = script.Parent
chance = math.random(1,50)

tool.Selected:connect(function(mouse)
mouse.Button1Click:connect(function()
if mouse.Target and mouse.Target:IsA("Model") then
hum = mouse.Target:FindFirstChild("Humanoid")
if hum ~= nil then
for k,v in pairs(mouse.Target:GetChildren()) do
if v:IsA("Tool") then
if chance == 1 then
a = v:Clone()
a.Parent = tool.Parent
v:Remove()
end
end
end
end
end
end)
end)
Report Abuse
lombardo2 is not online. lombardo2
Joined: 30 Nov 2008
Total Posts: 1604
12 Jun 2012 08:16 PM
Also that is cloning and removing the old ball, and setting the new to players backpack, you can change the

a = v:Clone()
a.Parent = tool.Parent
v:Remove()

to

hum.Parent
Report Abuse
lombardo2 is not online. lombardo2
Joined: 30 Nov 2008
Total Posts: 1604
12 Jun 2012 08:45 PM
Ah, a friend helped me to test the tool so I fixed the errors, lol I used Mouse button1Click XD dont know what i was thinking

tool = script.Parent

tool.Selected:connect(function(mouse)
mouse.Button1Down:connect(function()
if mouse.Target and mouse.Target.Parent:IsA("Model") then
hum = mouse.Target.Parent:FindFirstChild("Humanoid")
if hum ~= nil then
for k,v in pairs(mouse.Target.Parent:GetChildren()) do
if v:IsA("Tool") then
local chance = math.random(1,50)
if chance == 1 then
v.Parent = tool.Parent
end
end
end
end
end
end)
end)
Report Abuse
PokemonGuy365 is not online. PokemonGuy365
Joined: 21 Dec 2010
Total Posts: 13482
12 Jun 2012 08:55 PM
thank you
Report Abuse
PokemonGuy365 is not online. PokemonGuy365
Joined: 21 Dec 2010
Total Posts: 13482
12 Jun 2012 09:01 PM
wait did you just use a scirpt and brick as the tool?

Like the basic
Weld Script
Then this script
Then the brick that you where holding
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