|
| 04 Feb 2012 09:28 PM |
local Tool = script.Parent;
local walking = 0 local hold local walk local gunMode = false
enabled = true function onButton1Down(mouse) if not enabled then return end if gunMode~= true then local vCharacter = Tool.Parent local hum = vCharacter:findFirstChild("Humanoid") blah = hum:LoadAnimation(script.Parent.Slash) blah:Play()
enabled = false mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
wait(1.6) mouse.Icon = "rbxasset://textures\\GunCursor.png" enabled = true else if gunMode = true then script.Parent.GripPos = Vector3.new(-1,0,4) wait(0.5) script.Parent.GripPos = Vector3.new(-1,0,0) end
end
function onKeyDown(key) if walk and (key == "w") or (key == "a") or (key == "s") or (key == "d") then walk:Play() walking = walking + 1 else if (key=="f") script.Parent.GripPos = Vector3.new(-1,0,5) end end
function onKeyUp(key) if walk and (key == "w") or (key == "a") or (key == "s") or (key == "d") then walking = walking - 1 if walking == 0 then walk:Stop(0)
end end end
function onEquippedLocal(mouse)
if mouse == nil then print("Mouse not found") return end
local vCharacter = Tool.Parent local humanoid = vCharacter.Humanoid
hold = humanoid:LoadAnimation(Tool.holdstaff) walk = humanoid:LoadAnimation(Tool.walkstaff)
hold:Play()
mouse.Icon = "rbxasset://textures\\GunCursor.png" mouse.Button1Down:connect(function() onButton1Down(mouse) end) mouse.KeyDown:connect(onKeyDown) mouse.KeyUp:connect(onKeyUp) end
function onUnequippedLocal() hold:Stop() walk:Stop()
hold = nil walk = nil end
Tool.Equipped:connect(onEquippedLocal) Tool.Unequipped:connect(onUnequippedLocal)
I'm trying to make it so that the weapon changes its grip position when I press 'f'. Unfortunately, when I do that, the engine is rude enough to give me no output and nothing happens. |
|
|
| Report Abuse |
|
|
Phellem
|
  |
| Joined: 04 Aug 2011 |
| Total Posts: 1984 |
|
|
| 04 Feb 2012 09:33 PM |
"function onKeyDown(key) if walk and (key == "w") or (key == "a") or (key == "s") or (key == "d") then walk:Play() walking = walking + 1 else if (key=="f") --[[ <--- Mistake here ]]-- script.Parent.GripPos = Vector3.new(-1,0,5) end end"
--[[FIXED]]-- function onKeyDown(key) if walk and key == "w") or (key == "a") or (key == "s") or (key == "d") then walk:Play() walking = walking + 1 elseif (key=="f") then script.Parent.GripPos = Vector3.new(-1,0,5) end end |
|
|
| Report Abuse |
|
|
dirk29
|
  |
| Joined: 26 May 2010 |
| Total Posts: 1142 |
|
|
| 04 Feb 2012 09:39 PM |
after the Key function, use this:
key = key:lower() |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2012 02:43 PM |
| The script two posts above didn't work. I think it's because GripPos doesn't exist because the tool is being wielded. How would I fix this? |
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Feb 2012 10:03 PM |
| I'm serious. This is extremely annoying. Is there a place where the tool goes when it's wielded? |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2012 10:33 PM |
| Nevermind, the tool should be axcessable, but what is key:lower? |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Feb 2012 09:02 AM |
| key:lower() makes the key lowercase. Derp c: |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|