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: Debounce Help

Previous Thread :: Next Thread 
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
05 Apr 2014 04:20 PM
23:18:04.947 - Workspace.Epic Door.BackHandScanner.BackMain:12: attempt to index upvalue 'Debounce' (a boolean value)
23:18:04.947 - Script 'Workspace.Epic Door.BackHandScanner.BackMain', Line 12
23:18:04.947 - stack end
23:18:04.948 - Disconnected event because of exception



local Debounce = script.Parent.Parent.Debounce

if Debounce.Value == false then
Its a link to a boolvalue.
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
05 Apr 2014 04:28 PM
Searched it up and i dont think i can make local variables which are external.


so i removed the local, and now it says:


23:27:12.326 - Workspace.Epic Door.BackHandScanner.BackMain:12: attempt to index global 'Debounce' (a boolean value)
23:27:12.327 - Script 'Workspace.Epic Door.BackHandScanner.BackMain', Line 12
23:27:12.327 - stack end
23:27:12.328 - Disconnected event because of exception
Report Abuse
fireblade2 is not online. fireblade2
Joined: 18 Nov 2007
Total Posts: 4666
05 Apr 2014 04:33 PM
The script isn't finding "Debounce". Are you sure it's located in script.Parent.Parent?
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
05 Apr 2014 04:36 PM
Why are you using a bool value for debounce? Why not just make it a variable? For example...

local debounce = false
local delayTime = 3

script.Parent.Touched:connect(function(part)
if not debounce then
debounce = true
--do stuff
wait(delayTime)
debounce = false
else
return
end
end)
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
05 Apr 2014 05:28 PM
Because two scripts needs to know if theres a debounce.
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
05 Apr 2014 05:29 PM
Then make a global variable.

_G.Debounce = false
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
05 Apr 2014 05:29 PM
make them one script or use global variables.
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
05 Apr 2014 05:30 PM
if global i cant make more of these doors,
And one script, that would be pretty complicated to add together, while this goes easier.
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
05 Apr 2014 05:32 PM
If you make other doors, you can use a non-global 'debounce' variable, or just rename it...
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
05 Apr 2014 05:34 PM
But whats wrong with a boolean?
Its basicly a global local.
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
05 Apr 2014 05:34 PM
Post your entire original script.
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
05 Apr 2014 05:36 PM
Agggh, its kind of valuable.
Ill see if i can tho since im on ipad, but i posted it somewhere else, if not removed already.
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
05 Apr 2014 05:39 PM
I don't want to steal your script :P
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
05 Apr 2014 05:41 PM
Others might tho.

Raycasting has a prob on line 42 or 46 i think.
Some sort of hittedplayer being nil.


local PWC = script.Parent.PlayerWhoClicked
local C = script.Parent.Clicked
local PermissionList = {13831637, "Player1"}
Debounce = script.Parent.Parent.Debounce
local Doors = script.Parent.Parent.Doors
if PWC then
print("1")
C.Changed:connect(function()
print("2")
C.Value = false
print("3")
if Debounce.Value == false then
print("4")
Player = game.Players:FindFirstChild(PWC.Value)
if Player then
print("5")
local GroupRank = Player:GetRankInGroup(1065404)
local Entry = false
if GroupRank >= 1 then
Entry = true
end
if Entry == false then
for _, Permission in pairs(PermissionList) do
if (Permission == Player.userId) or (Permission == Player.Name) then
Entry = true
end
end
end
if Entry == true then
Debounce = true
for i = 0,3, 0.1 do
Doors.DoorTwo.CFrame = Doors.DoorTwo.CFrame + Vector3.new(0,0,0.1)
Doors.DoorOne.CFrame = Doors.DoorOne.CFrame + Vector3.new(0,0,-0.1)
wait(0.05)
end
wait(2)
for i = 0,3, 0.1 do
Doors.DoorTwo.CFrame = Doors.DoorTwo.CFrame + Vector3.new(0,0,-0.1)
Doors.DoorOne.CFrame = Doors.DoorOne.CFrame + Vector3.new(0,0,0.1)
wait(0.05)
end
Debounce = false
elseif Entry == false then
local Ray = Ray.new(Vector3.new(script.Parent.ScannerBack.Position), Vector3.new(Player.Character.Torso.Position))
local HittedPart, EndPoint = Workspace:FindPartOnRay(Ray)
local HittedPlayer = game.Players:GetPlayerFromCharacter(HittedPart.Parent)

local distance = (position - script.Parent.ScannerBack.Position).magnitude
local rayPart = Instance.new("Part", script.Parent.ScannerBack)
rayPart.Name = "RayPart"
rayPart.BrickColor = BrickColor.new("Really red")
rayPart.Transparency = 0.5
rayPart.Anchored = true
ray.Part.CanCollide = false
rayPart.TopSurface = Enum.SurfaceType.Smooth
rayPart.BottomSurface = Enum.SurfaceType.Smooth
rayPart.FormFactor = Enum.FormFactor.Custom
rayPart.Size = Vector3.new(0.2, 0.2, distance)
rayPart.CFrame = CFrame.new(position, script.Parent.ScannerBack.Position) * CFrame.new(0, 0, -distance/2)
game.Debris:AddItem(rayPart, 0.2)

if HittedPlayer.Character.Humanoid then
HittedPlayer.Character.Humanoid.Health = 0
end
end
end
end
end)
end
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
05 Apr 2014 05:44 PM
I might be wrong, but try this:

local Debounce = script.Parent.Parent:FindFirstChild("Debounce")

...

if Debounce then --check if debounce exists
if not Debounce.Value then --if the value is not true then...
blah blah blah
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
05 Apr 2014 05:55 PM
Ill also try to make a namechange, so it wont look for the variable debounce.

I hope this works :/
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