IRyan70
|
  |
| Joined: 08 Jun 2011 |
| Total Posts: 484 |
|
|
| 14 Sep 2014 09:06 PM |
Well my code below works for one time i press "e" to run the fireball code and then it doesnt work at all. Im trying to add a debounce so people dont spam the attack. Im not sure if i did it right. Please help? Thanks :)
Player = script.Parent.Parent mouse = Player:GetMouse() debounce = false function OnKeyDown(key) Key = key:lower() if key == "e" then if debounce == true then return elseif debounce == false then debounce = true local x = Instance.new("Part") x.BrickColor = BrickColor.new("Bright red") x.Size = Vector3.new(10,10,10) x.TopSurface = "Smooth" x.BottomSurface = "Smooth" x.Shape = "Ball" x.Transparency = 0.7 x.CanCollide = false x.Locked = true fd = script.Firedamage:Clone() fd.Parent = x fd.Disabled = false x.Name = Player.Name y = Instance.new("BodyVelocity") y.maxForce = Vector3.new(math.huge, math.huge, math.huge) y.velocity = Player.Character.Torso.CFrame.lookVector*80 x.Parent = workspace y.Parent = x f = Instance.new("Fire") f.Size = 15 f.Heat = 0 f.Parent = x x.CFrame = Player.Character.Torso.CFrame*CFrame.new(0,0,-12) while true do x.CFrame = x.CFrame * CFrame.fromEulerAnglesXYZ(0.1,0.1,0.1) wait(0.01) end game.Debris:AddItem(x,6) wait(1) debounce = false end end end mouse.KeyDown:connect(OnKeyDown)
|
|
|
| Report Abuse |
|
|
|
| 14 Sep 2014 09:08 PM |
| I'm no pro at using debounce, so I just call script.Disabled = true at the beginning of the function, and script.Disabled = false at the end. Works like a charm. |
|
|
| Report Abuse |
|
|
robomax11
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
|
| 14 Sep 2014 09:09 PM |
did u even maek this -_-
Player = script.Parent.Parent mouse = Player:GetMouse() deb = true function OnKeyDown(key) Key = key:lower() if Key == "e" then -- first you define Key as key:lower() then you use key... if deb then deb = false local x = Instance.new("Part") x.BrickColor = BrickColor.new("Bright red") x.Size = Vector3.new(10,10,10) x.TopSurface = "Smooth" x.BottomSurface = "Smooth" x.Shape = "Ball" x.Transparency = 0.7 x.CanCollide = false x.Locked = true fd = script.Firedamage:Clone() fd.Parent = x fd.Disabled = false x.Name = Player.Name y = Instance.new("BodyVelocity") y.maxForce = Vector3.new(math.huge, math.huge, math.huge) y.velocity = Player.Character.Torso.CFrame.lookVector*80 x.Parent = workspace y.Parent = x f = Instance.new("Fire") f.Size = 15 f.Heat = 0 f.Parent = x x.CFrame = Player.Character.Torso.CFrame*CFrame.new(0,0,-12) while true do x.CFrame = x.CFrame * CFrame.fromEulerAnglesXYZ(0.1,0.1,0.1) wait(0.01) end
game.Debris:AddItem(x,6) wait(1) deb = true end end end mouse.KeyDown:connect(OnKeyDown) |
|
|
| Report Abuse |
|
|
IRyan70
|
  |
| Joined: 08 Jun 2011 |
| Total Posts: 484 |
|
|
| 14 Sep 2014 09:11 PM |
| Oh Thanks @above. Sorry for the dumb errors, its an old script i made along time ago and im fixing the game. Thanks again :) |
|
|
| Report Abuse |
|
|
|
| 14 Sep 2014 09:13 PM |
| Lol you're full of crap :) |
|
|
| Report Abuse |
|
|
IRyan70
|
  |
| Joined: 08 Jun 2011 |
| Total Posts: 484 |
|
|
| 14 Sep 2014 09:15 PM |
| I just tested it and seems to do the same thing. Shoots 1 time, doesnt do anything the next time. Hmm fix? |
|
|
| Report Abuse |
|
|
robomax11
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
|
| 14 Sep 2014 09:15 PM |
@great
pls, we arent here to judge. i usually can tell lies or not. pls dont be mean |
|
|
| Report Abuse |
|
|
IRyan70
|
  |
| Joined: 08 Jun 2011 |
| Total Posts: 484 |
|
|
| 14 Sep 2014 09:15 PM |
| Um alright oculus. I guess i am then to you. Im just trying to fix my old script. |
|
|
| Report Abuse |
|
|
robomax11
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
|
| 14 Sep 2014 09:16 PM |
Player = script.Parent.Parent mouse = Player:GetMouse() deb = true ---------- function OnKeyDown(key) Key = key:lower() if Key == "e" then -- first you define Key as key:lower() then you use key... if deb then deb = false local x = Instance.new("Part") x.BrickColor = BrickColor.new("Bright red") x.Size = Vector3.new(10,10,10) x.TopSurface = "Smooth" x.BottomSurface = "Smooth" x.Shape = "Ball" x.Transparency = 0.7 x.CanCollide = false x.Locked = true fd = script.Firedamage:Clone() fd.Parent = x fd.Disabled = false x.Name = Player.Name y = Instance.new("BodyVelocity") y.maxForce = Vector3.new(math.huge, math.huge, math.huge) y.velocity = Player.Character.Torso.CFrame.lookVector*80 x.Parent = workspace y.Parent = x f = Instance.new("Fire") f.Size = 15 f.Heat = 0 f.Parent = x x.CFrame = Player.Character.Torso.CFrame*CFrame.new(0,0,-12) while true do x.CFrame = x.CFrame * CFrame.fromEulerAnglesXYZ(0.1,0.1,0.1) wait(0.01) game.Debris:AddItem(x,6) wait(1) deb = true end end end mouse.KeyDown:connect(OnKeyDown) |
|
|
| Report Abuse |
|
|
|
| 14 Sep 2014 09:16 PM |
| I'm not hating, but anyone who coded that at any point in time can do debounce. |
|
|
| Report Abuse |
|
|
robomax11
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
|
| 14 Sep 2014 09:17 PM |
| lold how u think this is advanced |
|
|
| Report Abuse |
|
|
IRyan70
|
  |
| Joined: 08 Jun 2011 |
| Total Posts: 484 |
|
|
| 14 Sep 2014 09:18 PM |
| Just because i study cframe,instancing,key functions and "while true do" doesnt mean im the best at debouncing. I never thought i would need it so i didnt learn it. Thanks though. |
|
|
| Report Abuse |
|
|
iiEssence
|
  |
| Joined: 18 Jun 2014 |
| Total Posts: 3467 |
|
|
| 14 Sep 2014 09:18 PM |
| lold how u think this is advanced [2] |
|
|
| Report Abuse |
|
|
|
| 14 Sep 2014 09:19 PM |
| I never called this advanced. Anyone who has made a successful .Touched event knows how to debounce though, and this is undeniably more advanced, even if slightly, than a .Touched. So if you're suggesting he made this, and never even made a .Touched, I do not understand your logic. |
|
|
| Report Abuse |
|
|
robomax11
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
|
| 14 Sep 2014 09:20 PM |
@great
newbags are the hardest to break.
initiation time ok
-punch- |
|
|
| Report Abuse |
|
|
|
| 14 Sep 2014 09:21 PM |
| Nice try. You lost this argument meh friend. GG |
|
|
| Report Abuse |
|
|
robomax11
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
|
| 14 Sep 2014 09:22 PM |
im not your friend.
im ur worst nightmare
1v1 scriptwar |
|
|
| Report Abuse |
|
|
|
| 14 Sep 2014 09:23 PM |
lul m8
i rek u sun
breng da heat
(Jk, I'm nowhere near as good as you guys at coding.) |
|
|
| Report Abuse |
|
|
robomax11
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
|
| 14 Sep 2014 09:24 PM |
k
game.playerz.grtoculis:rekt()
|
|
|
| Report Abuse |
|
|
| |
|
robomax11
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
|
| 14 Sep 2014 09:27 PM |
game.plrz.rbmx11:givehack()
rbmx11:chat('kill:grt')
>rekt |
|
|
| Report Abuse |
|
|
IRyan70
|
  |
| Joined: 08 Jun 2011 |
| Total Posts: 484 |
|
|
| 14 Sep 2014 09:28 PM |
| Since theres alot of knowledgeable scripters here (exception of oculus), is there a way to limit how many terrain blocks a player can create at once in a personal build server? The goal of it is to stop people from flooding. Is it possible? |
|
|
| Report Abuse |
|
|
|
| 14 Sep 2014 09:29 PM |
| Lol shots fired @ me. Thanks bruh |
|
|
| Report Abuse |
|
|
robomax11
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
|
| 14 Sep 2014 09:29 PM |
when a player creates a block there is no way to trace back the block to a player, if you edited the terrain tools, you could edit and be able to track players blocks placed within a certain time peroid using tick()
dont h8 m8 grtoc is gr8 m8 i r8 8/8 |
|
|
| Report Abuse |
|
|
|
| 14 Sep 2014 09:30 PM |
| Well, if its a block and not a terrain part, you can always set it's name to the name of the player wyho placed it in order to track it. |
|
|
| Report Abuse |
|
|