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: FPS gun help?

Previous Thread :: Next Thread 
Ruinable is not online. Ruinable
Joined: 14 Sep 2014
Total Posts: 8903
07 Nov 2014 03:56 PM
No errors, it just drags me under the baseplate.

local tool = script.Parent
tool.Equipped:connect(function(mouse)
mouse.Move:connect(function()
tool.Handle.CFrame=CFrame.new(tool.Handle.CFrame.p,mouse.hit.p):toObjectSpace(tool.Handle.CFrame);
end)
end)


gr8 b8 on a sl8 pl8 of f8 m8 | ( ͡° ͜ʖ ͡°)
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
07 Nov 2014 04:03 PM
What's with the random toObjectSpace?
Report Abuse
Ruinable is not online. Ruinable
Joined: 14 Sep 2014
Total Posts: 8903
07 Nov 2014 08:49 PM
What do you mean?

gr8 b8 on a sl8 pl8 of f8 m8 | ( ͡° ͜ʖ ͡°)
Report Abuse
Ruinable is not online. Ruinable
Joined: 14 Sep 2014
Total Posts: 8903
07 Nov 2014 09:02 PM
Seriously guys, I've been looking for help in FMs for hours

gr8 b8 on a sl8 pl8 of f8 m8 | ( ͡° ͜ʖ ͡°)
Report Abuse
jakej78b is not online. jakej78b
Joined: 09 Mar 2011
Total Posts: 813
07 Nov 2014 09:05 PM
Can you describe what you are trying to do? Also, don't use ; at the end of lines, it's not required in lua and it's a bad practice.
Report Abuse
Ruinable is not online. Ruinable
Joined: 14 Sep 2014
Total Posts: 8903
07 Nov 2014 09:06 PM
This, "Up and down" gun movement.

https://www.youtube.com/watch?v=kKY7AMMlNpQ

gr8 b8 on a sl8 pl8 of f8 m8 | ( ͡° ͜ʖ ͡°)
Report Abuse
jakej78b is not online. jakej78b
Joined: 09 Mar 2011
Total Posts: 813
07 Nov 2014 09:18 PM
The one in the video appeared to make your gun go up and down when you moved, not when the mouse moved. Might be better to use a KeyDown event, so that it isn't fired as often.

http://wiki.roblox.com/index.php?title=API:Class/Mouse/KeyDown

As for teleporting under the map, it could be because the Handle of your gun is positioned awkwardly, to where it makes you go under the map. CFraming and animations aren't really my thing, but that's my piece.
Report Abuse
Ruinable is not online. Ruinable
Joined: 14 Sep 2014
Total Posts: 8903
07 Nov 2014 10:16 PM
I mean the looking up and down.
Report Abuse
Ruinable is not online. Ruinable
Joined: 14 Sep 2014
Total Posts: 8903
08 Nov 2014 08:54 AM
.

gr8 b8 on a sl8 pl8 of f8 m8 | ( ͡° ͜ʖ ͡°)
Report Abuse
DeviousDeviation is not online. DeviousDeviation
Joined: 28 Dec 2010
Total Posts: 9306
08 Nov 2014 09:17 AM
Use welds, not CFrame

guise i have a siggy
Report Abuse
devSurface is not online. devSurface
Joined: 09 Feb 2013
Total Posts: 1339
08 Nov 2014 09:26 AM
http://www.roblox.com/gun-item?id=186063112


There, use it's scripts.
It just like RAT's engine.

It doesnt have the gui's n stuff, but you can make the guis in it, really easy.

And uhm, you can aim downsights and has the same with the zoom in stuff as RAT.
Only it doesnt give particles effect swhile shooting.

Don't know how to use this at a new gn model you made?

Contact me!

~ Dylan.
Report Abuse
devSurface is not online. devSurface
Joined: 09 Feb 2013
Total Posts: 1339
08 Nov 2014 09:41 AM
wow..
not even a thanks and you took my model

same for you demon8845


this forum is really going down.
Report Abuse
Ruinable is not online. Ruinable
Joined: 14 Sep 2014
Total Posts: 8903
08 Nov 2014 09:44 AM
Sorry, I was testing.
It didn't work.
Could you help me out?

(Btw, do you remember me? You developed for.. Eviction I think?)

gr8 b8 on a sl8 pl8 of f8 m8 | ( ͡° ͜ʖ ͡°)
Report Abuse
devSurface is not online. devSurface
Joined: 09 Feb 2013
Total Posts: 1339
08 Nov 2014 09:45 AM
Possible,

+ the gun works;

i've just tested it.

skype me;

dyldiesbuil
Report Abuse
Ruinable is not online. Ruinable
Joined: 14 Sep 2014
Total Posts: 8903
08 Nov 2014 09:48 AM
I tried to draw out the movement parts cause I want to use my own shooter script
http://www.roblox.com/Ruinables-Place-Number-27-place?id=185535274
This is all in a seperate localscript



local Tool = script.Parent
local plr = game.Players.LocalPlayer
local Character = plr.Character
local Mouse = plr:GetMouse()
local Camera = workspace.CurrentCamera
local Settings = {
OneHanded = false
,FakeArms = true
,FakeArmTransparency = 0
,RightPos = CFrame.new(-0.75, -0.25, 0.5) * CFrame.Angles(math.rad(-90), 0, 0)
,LeftPos = CFrame.new(1, 1, 0.5) * CFrame.Angles(math.rad(-90), math.rad(45), 0)
,AimPart = Tool.AimPart
,AimPartOffset = CFrame.new()
,AimGripOffset = Vector3.new(0, 0, 0)
,LeftAimPos = CFrame.new(1, 1.2, 0.5) * CFrame.Angles(math.rad(-90), math.rad(30), 0)
,AimAnim = {
Enabled = false
,Frames = 50
,Time = 0.1}}


Camera.Changed:connect(function()
if (Camera.Focus.p - Camera.CoordinateFrame.p).magnitude < 1 and Equipped then
Mouse.TargetFilter = workspace
Character.Torso.Neck.C1 = CFrame.new()
Character.Torso.Neck.C0 = CFrame.new(0, 1.5, 0) * CFrame.Angles(math.asin((Mouse.Hit.p - Mouse.Origin.p).unit.y), 0, 0)
end
end)
Mouse.Idle:connect(function()
if (Camera.Focus.p - Camera.CoordinateFrame.p).magnitude < 1 and Equipped then
Mouse.TargetFilter = workspace
Character.Torso.Neck.C1 = CFrame.new()
Character.Torso.Neck.C0 = CFrame.new(0, 1.5, 0) * CFrame.Angles(math.asin((Mouse.Hit.p - Mouse.Origin.p).unit.y), 0, 0)
end
end)
while wait() and Equipped do
if Sprinting then
Right_Weld.C0 = CFrame.new(0, -1.5, 0) * Settings.SprintArmOffset
Left_Weld.C0 = CFrame.new(0, -1.5, 0) * Settings.SprintArmOffset
elseif not Aiming then
Left_Weld.C0 = CFrame.new(0, -1.5, 0)
end
if (Camera.Focus.p - Camera.CoordinateFrame.p).magnitude > 1 and Equipped then
Mouse.TargetFilter = nil
Character.Torso.Neck.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
Character.Torso.Neck.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
end
end

local Arms_Made
local Fake_Arm_Right, Fake_Arm_Left, Fake_Arm_Model

Tool.Equipped:connect(function(Mouse)
if Character and not Arms_Made then
Arms_Made = true
local Torso = Character.Torso
Torso["Right Shoulder"].Part1 = nil
Left_Weld = Instance.new("Weld", Torso)
Left_Weld.Name = "Left_Weld"
Left_Weld.Part0 = Character.Head
Left_Weld.C0 = CFrame.new(0, -1.5, 0)
if not Settings.OneHanded then
Torso["Left Shoulder"].Part1 = nil
Left_Weld.Part1 = Character["Left Arm"]
end
Right_Weld = Instance.new("Weld", Torso)
Right_Weld.Name = "Right_Weld"
Right_Weld.Part0 = Character.Head
Right_Weld.Part1 = Character["Right Arm"]
Right_Weld.C0 = CFrame.new(0, -1.5, 0)
Left_Weld.C1 = Settings.LeftPos
Right_Weld.C1 = Settings.RightPos
end
if Settings.FakeArms and not Fake_Arm_Right then
Fake_Arm_Right, Fake_Arm_Left = Character["Right Arm"]:Clone(), Character["Left Arm"]:Clone()
Fake_Arm_Right.FormFactor, Fake_Arm_Left.FormFactor = "Custom", "Custom"
Fake_Arm_Right.Size, Fake_Arm_Left.Size = Vector3.new(), Vector3.new()
local fakeArms = {Fake_Arm_Right, Fake_Arm_Left}
for i = 1, 2 do
local w = Instance.new("Weld", fakeArms[i])
w.Part0 = Character[fakeArms[i].Name]
w.Part1 = fakeArms[i]
fakeArms[i].Transparency = Settings.FakeArmTransparency
end
Fake_Arm_Model = Instance.new("Model", Camera)
Fake_Arm_Right.Parent = Fake_Arm_Model
if not Settings.OneHanded then
Fake_Arm_Left.Parent = Fake_Arm_Model
end
Fake_Arm_Model.Name = "FakeArms"
if Settings.CharacterMeshes then
for i, v in pairs(Character:GetChildren()) do
if v:IsA("CharacterMesh") and v.BodyPart == Enum.BodyPart.LeftArm or v:IsA("CharacterMesh") and v.BodyPart == Enum.BodyPart.RightArm then
v:Clone().Parent = Fake_Arm_Model
end
end
end
if Character:FindFirstChild("Shirt") then
Instance.new("Humanoid", Fake_Arm_Model)
Character.Shirt:Clone().Parent = Fake_Arm_Model
else
local Arm_Mesh = Instance.new("SpecialMesh", Fake_Arm_Right)
Arm_Mesh.MeshType, Arm_Mesh.Scale = "Brick", Vector3.new(5, 10, 5)
local Arm_Mesh2 = Instance.new("SpecialMesh", Fake_Arm_Left)
Arm_Mesh2.MeshType, Arm_Mesh2.Scale = "Brick", Vector3.new(5, 10, 5)
end
end
end)

Tool.Unequipped:connect(function()
Equipped = false
Tool.GripPos = Orig_Grip
Aiming = false
Settings.Spread = Orig_Spread
if Settings.ChangeFOV[1] then
Camera.FieldOfView = 70
end
if Gui then
Gui:Destroy()
Gui = nil
end
for i, v in pairs(Tool.Handle:GetChildren()) do
if v:IsA("Sound") then
v:Stop()
end
end
if Fake_Arm_Right and Fake_Arm_Left and Fake_Arm_Model then
Fake_Arm_Model:Destroy()
Fake_Arm_Right, Fake_Arm_Left, Fake_Arm_Model = nil, nil, nil
end
if Character and Left_Weld and Right_Weld then
Arms_Made = false
local Torso = Character.Torso
Torso["Right Shoulder"].Part1, Torso["Left Shoulder"].Part1 = Character["Right Arm"], Character["Left Arm"]
Left_Weld:Destroy()
Right_Weld:Destroy()
end
Sprinting = false
Character.Torso.Neck.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
Character.Torso.Neck.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
Character.Humanoid.WalkSpeed = 16
end)

gr8 b8 on a sl8 pl8 of f8 m8 | ( ͡° ͜ʖ ͡°)
Report Abuse
devSurface is not online. devSurface
Joined: 09 Feb 2013
Total Posts: 1339
08 Nov 2014 09:50 AM
Eh,
you could the best edit it, not copy parts.

this script is really to advanced for me too..

i can help you with making it in format of guns, etc.

not that much of a problem, and a little editing with guis, wouldnt be that hard?
Report Abuse
DeviousDeviation is not online. DeviousDeviation
Joined: 28 Dec 2010
Total Posts: 9306
08 Nov 2014 09:53 AM
hao to get the angle for teh gun

local angle = CFrame.new(HEAD.Position, MOUSE.Hit.p).lookVector.Y

when the mouse moves
NECK.C0 = CFrame.new(0, 1.5, 0) * CFrame.Angles(math.asin(angle), 0, 0)

guise i have a siggy
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