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: Always equipped weapon?

Previous Thread :: Next Thread 
jonathan48 is not online. jonathan48
Joined: 30 Apr 2008
Total Posts: 1227
22 Jul 2014 10:01 AM
I know I've seen this before. How do you make a weapon, like, say, a sword, that is defaultly equipped and you can't deselect it. It doesnt show up in the toolbox either?
Report Abuse
ArbiterOfDeath is not online. ArbiterOfDeath
Joined: 20 Jun 2011
Total Posts: 1458
22 Jul 2014 10:20 AM
The way that I would do this is welding a weapon to the player's arm and then using the player:GetMouse method to get the mouse. You wouldn't even need a Tool object.
Report Abuse
DeSpizer27 is not online. DeSpizer27
Joined: 13 Jul 2012
Total Posts: 2679
22 Jul 2014 10:21 AM
^
Report Abuse
CaptainSource is not online. CaptainSource
Joined: 08 Jun 2013
Total Posts: 848
22 Jul 2014 10:21 AM
so its not tool its kinda part and script using getmouse
Report Abuse
jonathan48 is not online. jonathan48
Joined: 30 Apr 2008
Total Posts: 1227
22 Jul 2014 10:50 AM
I'm sorry, I'm pretty new to making tools and weapons.

So I would need a script that welds the weapon to the player's arm right when they join?
Report Abuse
jonathan48 is not online. jonathan48
Joined: 30 Apr 2008
Total Posts: 1227
22 Jul 2014 10:59 AM
Bump
Report Abuse
CWRA0444 is not online. CWRA0444
Joined: 14 Jan 2010
Total Posts: 6013
22 Jul 2014 11:04 AM
If you dont understand this you might want to do some research before you make the weapon... Those people described it as well as you can pretty much.
Report Abuse
ArbiterOfDeath is not online. ArbiterOfDeath
Joined: 20 Jun 2011
Total Posts: 1458
22 Jul 2014 11:11 AM
Someone else wanted some help with a script and a wrote accidentally wrote the script that you needed instead >.< I'll repost it here.

local tool = --Change this
local player = --And this
local character = player.Character or player.CharacterAdded:wait()
local mouse = player:GetMouse()

local function weld(part0, part1)
local joint = Instance.new("Weld", part0)
joint.Part0 = part0
joint.Part1 = part1
joint.C0 = CFrame.new() * CFrame.Angles()--You will need to mess with these to
joint.C1 = CFrame.new() * CFrame.Angles()--rotate the tool correctly.
end

local function onButton1Down()
local target = mouse.Target
local hit = mouse.Hit
--Do stuff here
end

weld(tool.Handle, character:WaitForChild("LeftArm"))
mouse.Button1Down:connect(onButton1Down)
Report Abuse
jonathan48 is not online. jonathan48
Joined: 30 Apr 2008
Total Posts: 1227
22 Jul 2014 11:12 AM
And so local tool is just a model that will be attached to the player?
Report Abuse
jonathan48 is not online. jonathan48
Joined: 30 Apr 2008
Total Posts: 1227
22 Jul 2014 11:21 AM
And in the angles part, do I put in the grip position stuff that I had in the old tool?
Report Abuse
ArbiterOfDeath is not online. ArbiterOfDeath
Joined: 20 Jun 2011
Total Posts: 1458
22 Jul 2014 11:23 AM
Yes and yes. Make sure the model has a part named "Handle." You will have to mess around with the angles and CFrames because it wont be as easy as the tool grip property, but it does the same thing.
Report Abuse
jonathan48 is not online. jonathan48
Joined: 30 Apr 2008
Total Posts: 1227
22 Jul 2014 11:24 AM
And then after the mousebutton1 part I can put in the sword swing animation and make it hurt people.

I feel like that sounds right, but I also might just be unintelligently thinking to myself.
Report Abuse
jonathan48 is not online. jonathan48
Joined: 30 Apr 2008
Total Posts: 1227
22 Jul 2014 11:24 AM
@Arbiter

Thanks. I'll have to mess around with that a bit.
Report Abuse
ArbiterOfDeath is not online. ArbiterOfDeath
Joined: 20 Jun 2011
Total Posts: 1458
22 Jul 2014 11:25 AM
Depends. If the animation only works on the player's body (like most do) then yes. I have made a animation that also moves the tool in the player's hand and that requires a motor6D instead of a weld between the left arm and the handle.
Report Abuse
jonathan48 is not online. jonathan48
Joined: 30 Apr 2008
Total Posts: 1227
22 Jul 2014 11:32 AM
Ok. Yeah, the weapon itself doesnt move, just the arm.
Report Abuse
jonathan48 is not online. jonathan48
Joined: 30 Apr 2008
Total Posts: 1227
22 Jul 2014 11:47 AM
After the local player part, would game.Players:GetPlayers() work?
Also, it appears the script is stack ending on the third line.

12:45:18.986 - Workspace.Script:3: attempt to index field 'CharacterAdded' (a nil value)
Is what it says.

Should

player.CharacterAdded:wait()

be changed to

player:CharacterAdded()
wait()

?
Report Abuse
jonathan48 is not online. jonathan48
Joined: 30 Apr 2008
Total Posts: 1227
22 Jul 2014 02:39 PM
Bump
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