|
| 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 |
|
|
| |
|
| |
|
| |
|
| |
|
H5L
|
  |
| Joined: 19 Jun 2013 |
| Total Posts: 352 |
|
|
| 20 Jun 2013 09:34 PM |
Bump ~Makes no sense to bump~ |
|
|
| Report Abuse |
|
|
| |
|
| |
|
RoAnt
|
  |
| Joined: 14 Jul 2008 |
| Total Posts: 16794 |
|
|
| 20 Jun 2013 10:54 PM |
First... no output? Second "h:UnequipTools()" ?
|
|
|
| Report Abuse |
|
|
|
| 20 Jun 2013 11:05 PM |
| There is no output. UnequipTools() works, that's not the problem. |
|
|
| Report Abuse |
|
|
Croze
|
  |
| Joined: 21 Mar 2010 |
| Total Posts: 449 |
|
| |
|
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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|