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: GripPosition

Previous Thread :: Next Thread 
thek00lkid is not online. thek00lkid
Joined: 18 Jun 2011
Total Posts: 2778
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 is not online. 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 is not online. 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
thek00lkid is not online. thek00lkid
Joined: 18 Jun 2011
Total Posts: 2778
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
LuisPambid is not online. LuisPambid
Joined: 31 Mar 2011
Total Posts: 532
06 Feb 2012 03:01 PM
LOL?
Report Abuse
thek00lkid is not online. thek00lkid
Joined: 18 Jun 2011
Total Posts: 2778
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
thek00lkid is not online. thek00lkid
Joined: 18 Jun 2011
Total Posts: 2778
06 Feb 2012 10:33 PM
Nevermind, the tool should be axcessable, but what is key:lower?
Report Abuse
thek00lkid is not online. thek00lkid
Joined: 18 Jun 2011
Total Posts: 2778
07 Feb 2012 08:53 AM
BUMP
Report Abuse
thejoker1997 is not online. thejoker1997
Joined: 19 Aug 2009
Total Posts: 155
07 Feb 2012 09:02 AM
key:lower() makes the key lowercase. Derp c:
Report Abuse
thek00lkid is not online. thek00lkid
Joined: 18 Jun 2011
Total Posts: 2778
07 Feb 2012 12:55 PM
Why would I need that?
Report Abuse
thek00lkid is not online. thek00lkid
Joined: 18 Jun 2011
Total Posts: 2778
07 Feb 2012 05:14 PM
BUMP
Report Abuse
thek00lkid is not online. thek00lkid
Joined: 18 Jun 2011
Total Posts: 2778
07 Feb 2012 05:41 PM
BUMP
Report Abuse
thek00lkid is not online. thek00lkid
Joined: 18 Jun 2011
Total Posts: 2778
07 Feb 2012 10:17 PM
A little help here?
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