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: Weld Script for Wedges?

Previous Thread :: Next Thread 
LordVertigo is not online. LordVertigo
Joined: 25 Dec 2011
Total Posts: 1622
01 Apr 2012 01:58 PM
I just used a basic weld script for guns, but I'm not sure how to make it check for wedges.



function Weld(x,y)
local W = Instance.new("Weld")
W.Part0 = x
W.Part1 = y
local CJ = CFrame.new(x.Position)
local C0 = x.CFrame:inverse()*CJ
local C1 = y.CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = x
end

function Get(A)
if A.className == "Part" then
Weld(script.Parent.Handle, A)
A.Anchored = false
else
local C = A:GetChildren()
for i=1, #C do
Get(C[i])
end
end
end

function Finale()
Get(script.Parent)
end

script.Parent.Equipped:connect(Finale)
script.Parent.Unequipped:connect(Finale)
Finale()
Report Abuse
Tiranin is not online. Tiranin
Joined: 03 Apr 2009
Total Posts: 18850
01 Apr 2012 01:59 PM
Replace:
"function Get(A)
if A.className == "Part" then"

With:

"function Get(A)
if A:IsA"Part" or A:IsA"Wedge" then"
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
01 Apr 2012 02:00 PM
if A:IsA("BasePart") then

This will include all parts like wedges, corners and trusses (+ seats).
Report Abuse
LordVertigo is not online. LordVertigo
Joined: 25 Dec 2011
Total Posts: 1622
01 Apr 2012 02:04 PM
Thanks.
Report Abuse
LordVertigo is not online. LordVertigo
Joined: 25 Dec 2011
Total Posts: 1622
01 Apr 2012 02:10 PM
Now the script works, but my character holds the gun backwords. The front end of the gun is on my character's right shoulder, and the back end of the gun is where the front end SHOULD be. Help?
Report Abuse
LordVertigo is not online. LordVertigo
Joined: 25 Dec 2011
Total Posts: 1622
01 Apr 2012 02:14 PM
Bump
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
01 Apr 2012 02:14 PM
The tool has Grip properties. Change those.
Report Abuse
AboveAwesome is not online. AboveAwesome
Joined: 24 Jul 2010
Total Posts: 1823
01 Apr 2012 02:16 PM
Dang, I was too late.
Well played, MrNicNac. Well played.

○ Interpret that any way you want. ○
Report Abuse
LordVertigo is not online. LordVertigo
Joined: 25 Dec 2011
Total Posts: 1622
01 Apr 2012 02:18 PM
@MrNicNac; How do they work? I change them a bit, but nothing happens to the guns.
Report Abuse
LordVertigo is not online. LordVertigo
Joined: 25 Dec 2011
Total Posts: 1622
01 Apr 2012 02:19 PM
As of now, they are as follows.

GripForward = 0, 0, -1
GripPos = 0, 0, 0
GripRight = 1, 0, 0
GripUp = 0, 1, 0
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
01 Apr 2012 02:19 PM
Change the C1 of the Weld so the X axis is rotated 180 degrees if the grip properties don't work, which they should.
Report Abuse
AboveAwesome is not online. AboveAwesome
Joined: 24 Jul 2010
Total Posts: 1823
01 Apr 2012 02:20 PM
You have to play with the Grip properties a bit. Try changing zeroes to ones, -1 to 0, etc.

○ Interpret that any way you want. ○

Report Abuse
LordVertigo is not online. LordVertigo
Joined: 25 Dec 2011
Total Posts: 1622
01 Apr 2012 02:21 PM
@Prehistoric; :\
Report Abuse
LordVertigo is not online. LordVertigo
Joined: 25 Dec 2011
Total Posts: 1622
01 Apr 2012 02:22 PM
@Above; Alright.

Is there any way to change them on the spot? By this I mean, change them and the gun automatically changes with it, without having to leave, refresh, and go into build mode again.
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
01 Apr 2012 02:23 PM
weld.C1 = weld.C1 * CFrame.Angles(math.rad(180), 0, 0)

I think. It has been a while since I messed with tools, CFrame and Welds.
Report Abuse
AboveAwesome is not online. AboveAwesome
Joined: 24 Jul 2010
Total Posts: 1823
01 Apr 2012 02:24 PM
I think they should update automatically. Just equip the gun when you do it.
If not, try cutting and pasting the gun back in.

○ Interpret that any way you want. ○
Report Abuse
AboveAwesome is not online. AboveAwesome
Joined: 24 Jul 2010
Total Posts: 1823
01 Apr 2012 02:25 PM
@Prehistoric
The weld script is for welding the parts of the gun to each other, not to the character.

○ Interpret that any way you want. ○
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
01 Apr 2012 02:26 PM
I assumed that before the welding was changed, the gun was the right way around so I thought that it might help...

whatever
Report Abuse
AboveAwesome is not online. AboveAwesome
Joined: 24 Jul 2010
Total Posts: 1823
01 Apr 2012 02:28 PM
Also, you don't need this part.

script.Parent.Equipped:connect(Finale)
script.Parent.Unequipped:connect(Finale)

It just adds unnecessary welds; welding it once will work fine instead of welding it every time you equip/unequip it.

○ Interpret that any way you want. ○
Report Abuse
AboveAwesome is not online. AboveAwesome
Joined: 24 Jul 2010
Total Posts: 1823
01 Apr 2012 02:29 PM
@ Prehistoric
I didn't mean to be mean, I was just sayin'. :[

○ Interpret that any way you want. ○
Report Abuse
LordVertigo is not online. LordVertigo
Joined: 25 Dec 2011
Total Posts: 1622
01 Apr 2012 02:36 PM
@Above; I got it to point in the direction I want. However, the gun is sideways.


Instead of holding the handle like this: "|"

My character is holding it like this: "_"


Let's see... How else can I describe it...

The gun is pointing straight, but it is laying on its side.
Report Abuse
AboveAwesome is not online. AboveAwesome
Joined: 24 Jul 2010
Total Posts: 1823
01 Apr 2012 02:36 PM
Try changing the Y of gripforward.

○ Interpret that any way you want. ○
Report Abuse
LordVertigo is not online. LordVertigo
Joined: 25 Dec 2011
Total Posts: 1622
01 Apr 2012 02:43 PM
@Above; It won't let me change the Y of GripForward without changing the Y of GripRight.
Report Abuse
AboveAwesome is not online. AboveAwesome
Joined: 24 Jul 2010
Total Posts: 1823
01 Apr 2012 02:45 PM
Just try messing with some of the values. You'll get it eventually. :D

○ Interpret that any way you want. ○
Report Abuse
LordVertigo is not online. LordVertigo
Joined: 25 Dec 2011
Total Posts: 1622
02 Apr 2012 07:07 PM
I've played and messed and fiddled with every value, there's no way I missed one. I've done different combinations for the past day. What is wrong with the gun? The BB-507 (a gun I created) works fine. Why doesn't this gun work?
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