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: How to keep activated running while player has mouse down?

Previous Thread :: Next Thread 
MrEpic534 is not online. MrEpic534
Joined: 12 May 2012
Total Posts: 1349
16 Nov 2014 09:55 AM
for example when i use activated on my gun all that happens is that its shoots 1 bullet and i have to keep clicking to fire multiple bullets
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
16 Nov 2014 10:00 AM
MouseDown >> isDown = true; while isDown do wait(something); fire(); end;
MouseUp >> isDown = false;
Report Abuse
MrEpic534 is not online. MrEpic534
Joined: 12 May 2012
Total Posts: 1349
16 Nov 2014 10:05 AM
^ i dont under stand can you dumb it down abit for me
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
16 Nov 2014 10:13 AM
No that was like, not even Lua. That was the simplest way I was ever going to write that.
Report Abuse
MrEpic534 is not online. MrEpic534
Joined: 12 May 2012
Total Posts: 1349
16 Nov 2014 10:30 AM
Oh sorry it's just that i didnt understand the >> but i get it now
Report Abuse
MrEpic534 is not online. MrEpic534
Joined: 12 May 2012
Total Posts: 1349
16 Nov 2014 10:53 AM
Where do i put the isdown = true? inside the function?
Report Abuse
djwill619 is not online. djwill619
Joined: 13 Jun 2011
Total Posts: 756
16 Nov 2014 10:57 AM
While Mouse.IsDown = true then
wait(0)
--code
end
Report Abuse
memorycode is not online. memorycode
Joined: 24 Sep 2011
Total Posts: 3322
16 Nov 2014 11:01 AM
@dj

fail...

you need two equal signs for checking
one for setting

also, does that even work? o.o
those four years of wumbology are really paying off
Report Abuse
DevUndead is not online. DevUndead
Joined: 24 Jul 2014
Total Posts: 558
16 Nov 2014 11:06 AM
^^ gj gg win mlg wumbology 360 no scope across the map point blanket jfk shot 429 blaze it double kill tactical nuke.
Report Abuse
MrEpic534 is not online. MrEpic534
Joined: 12 May 2012
Total Posts: 1349
16 Nov 2014 11:18 AM
Ok so here's my script so far can you tell me if i put the isdown in the right place if not can you reposition them for me
thank you!

player = game.Players.LocalPlayer
mouse = player:GetMouse()



Gun = script.Parent
Ammo = 30
mouse = player:GetMouse()
enabled = true
isdown = false
function shoot()
isdown = true

if Ammo >= 1 and enabled == true then


enabled = false
Ammo = Ammo -1
print ("You have " .. Ammo.. " Ammo left")
Gun.GripPos = Vector3.new(0, 1, 1)


Bullet = Instance.new("Part" , game.Workspace)
Bullet.Shape = "Ball"
Bullet.Size = Vector3.new(0.02, 0.02, 0.02)
Bullet.TopSurface = "Smooth"
Bullet.BottomSurface = "Smooth"
Bullet.CanCollide = false
Bullet.CFrame = Gun.Handle.CFrame
Bullet.CFrame = CFrame.new(Bullet.Position, mouse.Hit.p)
game.Debris:AddItem(Bullet, 2)


game.Players.LocalPlayer.PlayerGui.ScreenGui.Time.Text = tostring(Ammo)


v = Instance.new("BodyVelocity" , Bullet)
v.velocity = Bullet.CFrame.lookVector *150
v.maxForce = Vector3.new(math.huge, math.huge, math.huge)
Fire = Instance.new("Sound", Bullet)
Fire.SoundId = "http://roblox.com/asset/?id=10209803"
Pi = math.random(90, 110)
Pi = Pi/10
Fire.Pitch = Pi
Vo = math.random(90, 110)
Vo = Vo/10
Fire.Volume = Vo
Fire:Play()
game.Debris:AddItem(Fire, 2)
Gun.GripPos = Vector3.new(0,0,1)

local d = true
function onTouch(hit)

if hit.Parent:FindFirstChild("Humanoid") and d then
d = false

hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 1
if hit.Parent == player then
player.Humanoid.Health = player.Humanoid.Health +1
wait(3)
d = true
end


end

end
Bullet.Touched:connect(onTouch)


if Ammo == 0 then
game.Players.LocalPlayer.PlayerGui.ScreenGui.Time.Text = "Reloading"
wait(1.5)
Ammo = 30
game.Players.LocalPlayer.PlayerGui.ScreenGui.Time.Text = tostring(Ammo)
print("Reloading...")


end
game.Debris:AddItem(Bullet, 1.2)
enabled = true

function onKeyDown(key)
key = key:lower()
if key == "r" then
Ammo = 0
game.Players.LocalPlayer.PlayerGui.ScreenGui.Time.Text = "Reloading"
wait(1.5)
Ammo = 30
game.Players.LocalPlayer.PlayerGui.ScreenGui.Time.Text = tostring(Ammo)

function mouseDown(mouse)
if mouseDown == true then
game.Players.LocalPlayer.PlayerGui.ScreenGui.Time.Text = "Reloading"
end
mouse.MouseButton1Down:connect(mouseDown)
end
end


end

mouse.KeyDown:connect(onKeyDown)




end
isdown = false
end
script.Parent.Activated:connect(shoot)

while isdown == true do
shoot()
wait()

end

Report Abuse
MrEpic534 is not online. MrEpic534
Joined: 12 May 2012
Total Posts: 1349
16 Nov 2014 11:31 AM
ha
Report Abuse
MrEpic534 is not online. MrEpic534
Joined: 12 May 2012
Total Posts: 1349
16 Nov 2014 11:53 AM
HELP
Report Abuse
MrEpic534 is not online. MrEpic534
Joined: 12 May 2012
Total Posts: 1349
17 Nov 2014 12:43 AM
help pls
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
17 Nov 2014 12:54 AM
Ooh Elunates first time talking answering just normal e.e
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