|
| 15 Aug 2011 11:19 PM |
For some reason, when I use .Touched for a character, the script only works when the left leg is touching it..
I even tested it out by using:
print(hit)
..to make sure that it ONLY worked when the left leg was touching it, and it turns out, every time the output didn't say Left Leg, the script didn't work which was surprising..
Does anyone know if there's a way to fix this? It's quite annoying if I want to make it so ANY part can touch it, because sometimes, the Left Leg isn't always the easiest body part to use.. :/
Thanks in advance! :3 |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2011 11:20 PM |
More of my script is:
if script.Parent.Humanoid.Sit == true then
if that helps, incase .Parent is messing anything up.. |
|
|
| Report Abuse |
|
|
tdog158
|
  |
| Joined: 08 Jul 2008 |
| Total Posts: 5413 |
|
|
| 15 Aug 2011 11:21 PM |
| Could we see the whole script? I would say it's a debounce causing it but it's too early to tell. |
|
|
| Report Abuse |
|
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 15 Aug 2011 11:22 PM |
... What was the script?
That's... kind of insane. Without seeing the code I have no idea. |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2011 11:28 PM |
function onTouched(hit) print(hit) if hit.Name == "Right Leg" or hit.Name == "Left Leg" or hit.Name == "Left Arm" or hit.Name == "Right Arm" or hit.Name == "Head" then sittable = true else return end if hit.Parent.Humanoid.Sit == true and sittable == true then
if game.Players:GetPlayerFromCharacter(hit.Parent).PlayerGui.Choice.Customer.Value == true then hit.Parent.Handles.Color = BrickColor.new("Bright green") end
for i=1, 1500 do wait(.006) if hit.Parent.Humanoid.Sit == false then hit.Parent.Handles.Color = BrickColor.new("Mid gray") end end
if game.Players:GetPlayerFromCharacter(hit.Parent).PlayerGui.Choice.Customer.Value == true then hit.Parent.Handles.Color = BrickColor.new("Lime green") end
--^^it just repeats these last 2 groups of lines a bunch of times with the same things, just different colors.
end script.Parent.Touched:connect(onTouched)
__________________________________________
So it basically changes the Handle colors if the left leg touches the seat (to activate Humanoid.Sit) but if it's anything else, it will remain gray. (the handles are originally gray)
I thought about debounce, but I don't think it matters since if my left and right leg hit it together (as long as my left leg hits it) it still works fine... |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2011 11:54 PM |
*yawns* 1AM O_o
Okay, going to bed, and a bump for the night.
I won't respond (obviously) but I like it when my problems are solved overnight ;3 |
|
|
| Report Abuse |
|
|
Newtrat
|
  |
| Joined: 13 Jun 2011 |
| Total Posts: 196 |
|
|
| 16 Aug 2011 12:08 AM |
A few thoughts: It's possible that the problem isn't in this script, but in whatever script sets that value called Customer. Maybe for some bizarre reason Customer.Value is true only when the Left Leg is hit?
Also, I'm not sure you're organizing those if and for statements the way you want to. As it is now, the script will wait for a few seconds as long as Humanoid.Sit and sittable are both true, regardless of whether or not Customer.Value is true. So if Customer.Value is false, the script will probably appear to be doing nothing even though it is actually running. This is evidence for my hypothesis above, that somehow Customer.Value is only true when the Left Leg is hit... and if that's the case, another script, not this one, would be the culprit.
Otherwise, I'm not sure what's going on. Anybody else find something I missed? (or something I messed up on?) |
|
|
| Report Abuse |
|
|
|
| 16 Aug 2011 10:31 AM |
Hmm, I'm not sure.. I deleted my left leg, reset the value, and reset the script and tried all of my body parts but none worked even without my left leg :/
And yes, that's the way I want my if and for statement ;) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 16 Aug 2011 02:39 PM |
SUPER MEGA AWESOME HAPPY FUN TIME BUMP!
...
;3 |
|
|
| Report Abuse |
|
|
| |
|
| |
|
alexmach1
|
  |
| Joined: 02 May 2008 |
| Total Posts: 1977 |
|
|
| 16 Aug 2011 05:47 PM |
function onTouched(hit) if hit~=nil and hit.Parent~=nil and hit.Parent:FindFirstChild("Humanoid")~=nil then print(hit) sittable = true if hit.Parent.Humanoid.Sit == true and sittable == true then if game.Players:GetPlayerFromCharacter(hit.Parent).PlayerGui.Choice.Customer.Value == true then hit.Parent.Handles.Color = BrickColor.new("Bright green") end for i=1, 1500 do wait(.006) if hit.Parent.Humanoid.Sit == false then hit.Parent.Handles.Color = BrickColor.new("Mid gray") end end if game.Players:GetPlayerFromCharacter(hit.Parent).PlayerGui.Choice.Customer.Value == true then hit.Parent.Handles.Color = BrickColor.new("Lime green") end
--^^it just repeats these last 2 groups of lines a bunch of times with the same things, just different colors.
end end script.Parent.Touched:connect(onTouched)
output plz. i made it so if anything with a humanoid touches it, it activates.
|
|
|
| Report Abuse |
|
|
|
| 16 Aug 2011 06:06 PM |
| I still got the same results as before. Meh. The left leg has to touch it :/ |
|
|
| Report Abuse |
|
|
| |
|
| |
|