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: Problem with this script...

Previous Thread :: Next Thread 
riolusniper is not online. riolusniper
Joined: 13 Jul 2009
Total Posts: 1351
20 Jun 2013 05:19 PM
This script launches you up, and to the side when the part is touched. It works fine most of the time, but about 25% of the time, it flings you up and then you freeze before moving to the side.

This started happening since I put the Enabled Value parts into the script, but without those, the script breaks if a tool touches it. Does anyone know what the problem is?



local teleportfrom=script.Parent.Enabled.Value
function onTouched(part)

if script.Parent.Enabled.Value==0 then
return
end
wait()

if part.Parent ~= nil then
local h = part.Parent:FindFirstChild("Humanoid")
if h ~= nil then

script.Parent.Enabled.Value=0
h:UnequipTools()

script.Parent.BrickColor = BrickColor.new("Really red")
script.Parent.Smoke.Enabled = true

p = Instance.new("BodyPosition")
p.Parent = part.Parent.Torso
p.maxForce = Vector3.new(90000,90000,90000)
p.position = part.Parent.Torso.Position + Vector3.new(0,69,0)
wait(1)
p.position = part.Parent.Torso.Position + Vector3.new(0,0,18)
wait(0.4)
script.Parent.Smoke.Enabled = false
p:Remove()
script.Parent.BrickColor = BrickColor.new("Black")

wait(0.1)
script.Parent.Enabled.Value=1

end
end
end
script.Parent.Touched:connect(onTouched)
Report Abuse
riolusniper is not online. riolusniper
Joined: 13 Jul 2009
Total Posts: 1351
20 Jun 2013 06:15 PM
Bump
Report Abuse
riolusniper is not online. riolusniper
Joined: 13 Jul 2009
Total Posts: 1351
20 Jun 2013 07:10 PM
Bump
Report Abuse
riolusniper is not online. riolusniper
Joined: 13 Jul 2009
Total Posts: 1351
20 Jun 2013 08:27 PM
Bump
Report Abuse
riolusniper is not online. riolusniper
Joined: 13 Jul 2009
Total Posts: 1351
20 Jun 2013 09:24 PM
Bump
Report Abuse
H5L is not online. H5L
Joined: 19 Jun 2013
Total Posts: 352
20 Jun 2013 09:34 PM
Bump
~Makes no sense to bump~
Report Abuse
riolusniper is not online. riolusniper
Joined: 13 Jul 2009
Total Posts: 1351
20 Jun 2013 09:37 PM
Thanks for your help -_-
Report Abuse
riolusniper is not online. riolusniper
Joined: 13 Jul 2009
Total Posts: 1351
20 Jun 2013 10:43 PM
Bump
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
20 Jun 2013 10:54 PM

First... no output?
Second "h:UnequipTools()" ?

Report Abuse
riolusniper is not online. riolusniper
Joined: 13 Jul 2009
Total Posts: 1351
20 Jun 2013 11:05 PM
There is no output. UnequipTools() works, that's not the problem.
Report Abuse
Croze is not online. Croze
Joined: 21 Mar 2010
Total Posts: 449
20 Jun 2013 11:09 PM
Then what is the problem?
Report Abuse
Croze is not online. Croze
Joined: 21 Mar 2010
Total Posts: 449
20 Jun 2013 11:10 PM
Just put print("1") print("2") print("3") throughout the script and tell us what outputs the 75% of the time the script does not work
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
20 Jun 2013 11:19 PM
Whoops! Sorry, my mistake. Didn't realized Humanoid had a method called ":UnequpTools()."
Report Abuse
riolusniper is not online. riolusniper
Joined: 13 Jul 2009
Total Posts: 1351
21 Jun 2013 01:18 AM
According to the output, sometimes it repeats the BodyPosition changes, when it shouldn't be. It goes through let's say lines 1-20, then goes back a line, then continues. That's when it breaks.
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
21 Jun 2013 01:19 AM
I want to say use a debounce... but I think you already used it.
Report Abuse
riolusniper is not online. riolusniper
Joined: 13 Jul 2009
Total Posts: 1351
21 Jun 2013 01:23 AM
Actually, I did have a debounce in it at one time and it worked just fine, other than when a gun touched the brick, then it broke. That's why I stopped using the debounce, and switched to using the enabled value, which fixed that problem.

I'll try putting a debounce in again. I'm still a beginner scripter as you can tell... and this is out of my skill level so far ._.
Report Abuse
riolusniper is not online. riolusniper
Joined: 13 Jul 2009
Total Posts: 1351
21 Jun 2013 01:45 AM
It works! I've been trying to get this perfect for a week now. Thanks for helping me.
Report Abuse
Croze is not online. Croze
Joined: 21 Mar 2010
Total Posts: 449
21 Jun 2013 07:11 PM
If there's an issue with other parts touching it then check to see if the toucher.parent.Humanoid ~= nil
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