iJava
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 29914 |
|
|
| 09 Apr 2015 10:22 AM |
For some reason, after the first use, which works fine, my tool no longer changes the BoolValue in a player to Is_Zip_Tied's value to false, but there are no errors
This is my script inside of the tool
repeat wait() until game.Players.LocalPlayer.Character repeat wait() until game.Players.LocalPlayer.Character.Parent == workspace
local tool = script.Parent local player = game.Players.LocalPlayer local mouse = player:GetMouse() local character = player.Character local debounce = false
local disposableConnections = {}
function newDisposableConnection(connection) table.insert(disposableConnections, connection) end
function disposeOfConnections() for i, v in pairs(disposableConnections) do v:disconnect() end disposableConnections = {} end
function unbind(player) local zipVal = player:findFirstChild("Is_Zip_Tied") if zipVal ~= nil then zipVal.Value = false else local val = Instance.new('BoolValue', player) val.Name = 'Is_Zip_Tied' val.Value = false end end
tool.Equipped:connect(function(mouse) newDisposableConnection(mouse.Button1Down:connect(function() mouse_is_down = true end)) newDisposableConnection(mouse.Button1Up:connect(function() mouse_is_down = false end)) newDisposableConnection(game:GetService("RunService").RenderStepped:connect(function() script.Parent.Handle.Touched:connect(function(obj) local humanoid = obj.Parent:findFirstChild("Humanoid") if not debounce and mouse_is_down and obj.Parent ~= character and humanoid ~= nil then debounce = true local hitPlayer = obj.Parent unbind(hitPlayer) end end) end) ) end)
tool.Unequipped:connect(disposeOfConnections)
-Widths |
|
|
| Report Abuse |
|
|
iJava
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 29914 |
|
|
| 09 Apr 2015 10:23 AM |
Also please note that Is_Zip_Tied is inserted into every character upon spawning in another script, so it's always present
-Widths |
|
|
| Report Abuse |
|
|
iJava
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 29914 |
|
| |
|
iJava
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 29914 |
|
| |
|
iJava
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 29914 |
|
| |
|
iJava
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 29914 |
|
| |
|
iJava
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 29914 |
|
| |
|
iJava
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 29914 |
|
| |
|
WebGL3D
|
  |
| Joined: 04 Sep 2013 |
| Total Posts: 28311 |
|
|
| 09 Apr 2015 12:45 PM |
May not be the reason, but why this?
newDisposableConnection(game:GetService("RunService").RenderStepped:connect(function()
Wouldn't that just loop create the event?
~ 1Topcop ~ WebGL3D ~ Java3D ~ Data3D ~ Purple Squid > |
|
|
| Report Abuse |
|
|
iJava
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 29914 |
|
|
| 09 Apr 2015 12:48 PM |
idk, foreverdev told me to do that i removed it but i still have the same issue
-Widths |
|
|
| Report Abuse |
|
|
iJava
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 29914 |
|
| |
|
iJava
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 29914 |
|
| |
|
iJava
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 29914 |
|
|
| 09 Apr 2015 01:22 PM |
*facepalm* I never made debounce false again...
-Widths |
|
|
| Report Abuse |
|
|
robocu3
|
  |
| Joined: 13 Mar 2009 |
| Total Posts: 6485 |
|
| |
|