Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to prevent custom made food gear from getting stuck mid-bite?

Asked by 9 years ago

Hi Scripters.

I recently made this scone gear composed of several welded bricks. It works as expected when sitting idle in the hand, but when the Player clicks to bite the scone, it gets stuck mid-air and won't return to the idle position.

Here is the script inside the tool

local Tool = script.Parent;

enabled = true


function onActivated()
 if not enabled  then
  return
 end

 enabled = false
 Tool.GripForward = Vector3.new(0,-.759,-.651)
 Tool.GripPos = Vector3.new(1.5,-.5,.3)
 Tool.GripRight = Vector3.new(1,0,0)
 Tool.GripUp = Vector3.new(0,.651,-.759)

 Tool.Handle.DrinkSound:Play()

 wait(3)

 local h = Tool.Parent:FindFirstChild("Humanoid")
 if (h ~= nil) then
  if (h.MaxHealth > h.Health + 5) then
   h.Health = h.Health + 5
  else 
   h.Health = h.MaxHealth
  end
 end

 Tool.GripForward = Vector3.new(-.976,0,-0.217)
 Tool.GripPos = Vector3.new(0.03,0,0)
 Tool.GripRight = Vector3.new(.217,0,-.976)
 Tool.GripUp = Vector3.new(0,1,0)

 enabled = true

end

function onEquipped()
 Tool.Handle.OpenSound:play()
end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)

Is there any way to prevent this from happening?

Thanks much! -Legoseed

0
Please Code block your script! How? You see above are icons; the last to the right even says lua, Click it then paste the script **BETWEEN** the lines that appear. alphawolvess 1784 — 9y
0
Thanks! I updated that. legoseed 14 — 9y
0
Why did you use a semicolon for your variable? alphawolvess 1784 — 9y
0
I'm not sure actually. My scripting knowledge is really limited, I just followed the Roblox Wiki tutorial for custom gear. legoseed 14 — 9y
0
semicolon is okay in Lua YellowoTide 1992 — 9y

1 answer

Log in to vote
-3
Answered by
neoG457 315 Moderation Voter
9 years ago

Maybe the player wasn't done savouring the bite. Give him some time to enjoy the scone, jeez...

Ad

Answer this question