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: Is it possible to make a sword

Previous Thread :: Next Thread 
Lapwn is not online. Lapwn
Joined: 03 Jun 2012
Total Posts: 5975
14 Sep 2013 03:20 PM
That follows where you mouse moves when you click? So the sword would damage you ontouch and you would be able to swing at others with it.
Report Abuse
nobbers12345 is not online. nobbers12345
Joined: 06 Feb 2011
Total Posts: 4425
14 Sep 2013 03:21 PM
Wait, explain further.
Is it a click and drag to swing?
Or does it follow where you look?

«The level of your stupidity is infinite»
Report Abuse
Lapwn is not online. Lapwn
Joined: 03 Jun 2012
Total Posts: 5975
14 Sep 2013 03:22 PM
Your in third person and when you click down the tip follows your mouse in a 3d way. It's kind of complicated I'm not sure if it's possible .-.
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
14 Sep 2013 03:23 PM
It's complicated but possible.
Report Abuse
Lapwn is not online. Lapwn
Joined: 03 Jun 2012
Total Posts: 5975
14 Sep 2013 03:35 PM
What if you made your right arm point to whatever brick your mouse is over.
Report Abuse
nobbers12345 is not online. nobbers12345
Joined: 06 Feb 2011
Total Posts: 4425
14 Sep 2013 03:38 PM
Ive seen it before then, you need to make "fake" arms, I don't think it is possible to modify the actual player arms.

«The level of your stupidity is infinite»
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
14 Sep 2013 03:41 PM
here, localscript
repeat wait() until game.Players.LocalPlayer.Character
plr = game.Players.LocalPlayer
mouse = plr:GetMouse()
mouse.Move:connect(function()
plr.Character.Torso["Right Shoulder"].C0 = mouse.Origin.p
end)
--This may not work.
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
14 Sep 2013 03:42 PM
I can't remember exactly how to do what you originally asked, but I'll say what I can guess.

I'll give guide lines.

A. Take a free model of something that follows you hand around. I'm guessing they're using mouse.hit.p or mouse.origin.p.

B. Make a camera that it's camera subject is a welded part to a character that simulates 3rd person.

C. I'm not sure, actually.

I would have to run tests to know.
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
14 Sep 2013 03:45 PM
Change .C0 = mouse.Origin.p to
.C0 = CFrame.new(mouse.Origin.p)
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
14 Sep 2013 03:47 PM
But how would you get the rotation matrix part of the CFrame then...?
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
14 Sep 2013 03:49 PM
Im fixing it.. wait
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
14 Sep 2013 04:01 PM
repeat wait() until game.Players.LocalPlayer.Character
plr = game.Players.LocalPlayer
mousee = plr:GetMouse()
function getjoint()
player = bin.Parent
char = player
if char ~= nil then
torso = char:FindFirstChild("Torso")
if torso~= nil then
joint = torso:FindFirstChild("Right Shoulder")
if joint~=nil then
return joint
end
end
end
return nil
end

function getarm()
player = bin.Parent
char = player
if torso~= nil then
arm = char:FindFirstChild("Right Arm")
if arm~=nil then
return arm
end
end
return nil
end

function pointarmto(t, a, p, c0, c1)
mid = (t.CFrame*CFrame.new(c0)).p
dir = (mid - p).unit
rot = CFrame.fromEulerAnglesXYZ(math.pi/2, 0, 0)
rightangle = CFrame.fromEulerAnglesXYZ(0, 0, math.pi)
off = CFrame.new(c1)
a.CFrame = CFrame.new(mid, mid+dir)*rot*off*rightangle
end

function Bob(mouse)
    while sel do
        wait(0.01)
joint = getjoint()
local c0, c1 = nil
if joint~= nil then
c0 = joint.C0.p
c1 = joint.C1.p
arm = getarm()
arm.Anchored = true
torso = joint.Part0
joint.Part1 = nil
pointing = true
point = mouse.Hit.p
pointarmto(torso, arm, point, c0, c1)
end
end
end
sel = true
Bob(mousee)
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
14 Sep 2013 04:04 PM
Fixed*
repeat wait() until game.Players.LocalPlayer.Character
plr = game.Players.LocalPlayer
mousee = plr:GetMouse()
function getjoint()
player = plr
char = player
if char ~= nil then
torso = char:FindFirstChild("Torso")
if torso~= nil then
joint = torso:FindFirstChild("Right Shoulder")
if joint~=nil then
return joint
end
end
end
return nil
end

function getarm()
player = plr
char = player
if torso~= nil then
arm = char:FindFirstChild("Right Arm")
if arm~=nil then
return arm
end
end
return nil
end

function pointarmto(t, a, p, c0, c1)
mid = (t.CFrame*CFrame.new(c0)).p
dir = (mid - p).unit
rot = CFrame.fromEulerAnglesXYZ(math.pi/2, 0, 0)
rightangle = CFrame.fromEulerAnglesXYZ(0, 0, math.pi)
off = CFrame.new(c1)
a.CFrame = CFrame.new(mid, mid+dir)*rot*off*rightangle
end

function Bob(mouse)
    while sel do
        wait(0.01)
joint = getjoint()
local c0, c1 = nil
if joint~= nil then
c0 = joint.C0.p
c1 = joint.C1.p
arm = getarm()
arm.Anchored = true
torso = joint.Part0
joint.Part1 = nil
pointing = true
point = mouse.Hit.p
pointarmto(torso, arm, point, c0, c1)
end
end
end
sel = true
Bob(mousee)
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
14 Sep 2013 04:12 PM
Still wrong, wait a sec while i fix
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
14 Sep 2013 04:16 PM
^ You made that in 10 minutes tops? Genius.
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
14 Sep 2013 04:19 PM
Not really.
His script doesn't really work, either. Also, the physics could be much more efficient.
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
14 Sep 2013 04:28 PM
^
I got mine working, but You cant equip anything.
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