local Tool = script.Parent
reloadtime=.5
enabled = true
nadeon=false
function onButton1Down(mouse)
if not enabled then
return
end
enabled = false
mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
wait(reloadtime)
mouse.Icon = "rbxasset://textures\\GunCursor.png"
enabled = true
end
function onEquippedLocal(mouse)
if mouse == nil then
print("Mouse not found")
return
end
Ok this is the script in miked painball gun that lets him change modes now there is also a mode thing in the weapon then he has weapon scripts not hopperbins or tools. So in this script im trying to find the area where it shows the way you can switch modes with the key on the keyboard then i will have a few quesitons about how to edit this script to my needs so please help me.
mouse.Icon = "rbxasset://textures\\GunCursor.png"
if not enabled then
mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
end
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.KeyDown:connect(onKeyDown)
end
function onKeyDown(key)
if (key~=nil) then
local key = key:lower()
if (key=="q") then
if script.Parent.mode.Value<1 then
script.Parent.mode.Value=1
reloadtime=.5
pm(1)
elseif script.Parent.mode.Value==1 then
script.Parent.mode.Value=2
reloadtime=7
pm(2)
elseif script.Parent.mode.Value==2 then
script.Parent.mode.Value=3
reloadtime=.8
pm(3)
elseif script.Parent.mode.Value>2 then
script.Parent.mode.Value=1
reloadtime=.5
pm(1)
end
elseif (key=="r") then
if script.Parent.mode.Value<10 and nadeon==false then
nadeon=true
script.Parent.mode.Value=10+script.Parent.mode.Value
pm(11)
while script.Parent.mode.Value>10 do wait(1) end
wait(10)
nadeon=false
end
--elseif (key=="l") then
--pm(99)
end
end
end
Tool.Equipped:connect(onEquippedLocal)
function pm(x)
if game.Players:findFirstChild(script.Parent.Parent.Name)~=nil then
local bob=game.Players:findFirstChild(script.Parent.Parent.Name)
local mess=Instance.new("Message")
while bob:findFirstChild("Message")~=nil do bob.Message:remove() end
mess.Parent=bob
if x==1 then
mess.Text="Standard"
elseif x==2 then
mess.Text="Sniper"
elseif x==3 then
mess.Text="Burst"
elseif x==11 then
mess.Text="Grenade ON"
elseif x==99 then
if nadeon then lol=1 elseif not nadeon then lol=0 end
if script.Parent.Enabled then lol2=1 elseif not script.Parent.Enabled then lol2=0 end
mess.Text=("nadeon=" .. lol .. "; mode=" .. script.Parent.mode.Value .. ";")
wait(2)
mess.Text=("PBG enabled=" .. lol2 .. "; reload=" .. reloadtime .. ";")
end
wait(1)
mess.Parent=nil
end
end
function modechange()
mode=script.Parent.mode.Value
if mode==1 then
reloadtime=.5
elseif mode==2 then
reloadtime=4
elseif mode==3 then
reloadtime=.8
end
end
script.Parent.mode.Changed:connect(modechange) |