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..

Previous Thread :: Next Thread 
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
15 Feb 2014 08:37 PM
I have a part that always faces the nearest player's head.
I C-Framed a bunch of parts on it and used a weld script.
I want the bricks on it to turn with the part, but with the welds just holds them in place and only the part turns.
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
15 Feb 2014 08:40 PM
Bump
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
15 Feb 2014 08:46 PM
Double bump
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
15 Feb 2014 08:48 PM
Weld all minor parts to major part then Use CFrame.Angles to rotate major part :P
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
15 Feb 2014 08:49 PM
Provide a script.. the problem might be something else.
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
15 Feb 2014 08:51 PM
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
if A.Name == "Elixir" or A.Name == "Part" or A.Name == "Seat" or A.Name == "VehicleSeat" then
Weld(script.Parent.Main, A)
A.Anchored = false
end
else
local C = A:GetChildren()
for i=1, #C do
Get(C[i])
end
end
end

function Finale()
Get(script.Parent)
end

function unanchor()
local A = script.Parent:GetChildren()
for i = 1,#A do
if A.Name == "Part" or A.Name == "Wedge" or A.Name == "Seat" or A.Name == "VehicleSeat" then
A[i].Anchored = false
end
end
end

wait(1)
Finale()
unanchor()
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
15 Feb 2014 08:59 PM
Seriously noone knows how to fix this problem?
You don't have to give me the whole script, just hint me.
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
15 Feb 2014 09:02 PM
For the welds, it's not w.Part0,1,2..etc Just Part0
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
15 Feb 2014 09:06 PM
The weld script isn't wrong, I am just wondering how I can weld all those bricks to the rotating part and have those bricks rotate with the part. Right now, only the rotating parts rotate.
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
15 Feb 2014 09:09 PM
If any parts are welded to something, when you change the CFrame value on that something, then the welded parts move as well. So weld the parts to the main, and rotate the main using CFrame.Angles as I said before.
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
15 Feb 2014 09:37 PM
Here is the rotating script, can you make it so it uses CFrame.angle?

while wait() do
local x = game.Players:GetChildren()
if #x > 0 then
local closest = nil
local dist = 100
for _,player in pairs(game.Players:GetPlayers()) do
if player.Character:FindFirstChild("Head") then
local mag = (script.Parent.Position-player.Character.Head.Position).magnitude
if mag < dist then
script.Value.Value = player.Character.Head
script.Parent.Fire.Disabled = false
closest = player.Character.Head
dist = mag
end
end
end
if closest then script.Parent.CFrame = CFrame.new(script.Parent.Position,closest.Position) end
end
end
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
15 Feb 2014 09:43 PM
Bump
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
15 Feb 2014 11:27 PM
Bump
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
15 Feb 2014 11:32 PM
HELP D:
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
15 Feb 2014 11:39 PM
Noone knows? Come on.
Report Abuse
iIikeyou is not online. iIikeyou
Joined: 07 Mar 2012
Total Posts: 1659
15 Feb 2014 11:40 PM
Use this for welding.

I see no issues at all with your scripts, so I'm assuming the problem is that for whatever reason the parts were not properly unanchored... I don't know if this will fix the problem (probably won't) but it will definetly unanchor and weld all of the parts.



local function Weld(x,y)
local W = Instance.new("Weld",x)
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
end

local function Get(A)
if A:IsA'BasePart' then
if A.Name == "Elixir" or A.Name == "Part" or A.Name == "Seat" or A.Name == "VehicleSeat" then
Weld(script.Parent.Main, A)
end
A.Anchored=false
end
for _,v in ipairs(A:GetChildren())do
Get(v)
end
end

Get(script.Parent)
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
15 Feb 2014 11:50 PM
Let me try it >:)
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
15 Feb 2014 11:51 PM
I mean u could make a script using a while loop so it always has a certain cframe compared to the parts cframe.
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
15 Feb 2014 11:52 PM
I don't know how to do that .-.
Come to this place and you''ll know what I mean. I think welds pretty much makes the bricks anchored...

http://www.roblox.com/Project-Secret-place?id=130604839
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
15 Feb 2014 11:54 PM
I unanchored the main part(rotating part) and that made the other bricks rotate with it but then the main parts just flips around xD
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
16 Feb 2014 12:05 AM
Bump
Report Abuse
iIikeyou is not online. iIikeyou
Joined: 07 Mar 2012
Total Posts: 1659
16 Feb 2014 12:07 AM
If the main part flips around, use a BodyGyro to help control it. The main part will need to be unanchored for the welded parts to move with it
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
16 Feb 2014 12:18 AM
How do you use BodyGyro?
I've never used it before .-.
Report Abuse
iIikeyou is not online. iIikeyou
Joined: 07 Mar 2012
Total Posts: 1659
16 Feb 2014 12:25 AM
insert a BodyGyro into the main part in studio
increase the maxTorque to something like 10000,10000,1000
you can mess around with D (dampening, essentially it slows the turning down before it gets to its target to look smoother) and P (overall power it uses to turn) for aesthetic value

then, rather than changing the CFrame of the main part, change the 'cframe' property of the BodyGyro to the Head of the closest person and it should aim towards them
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
16 Feb 2014 12:26 AM
Can you follow me?
That won't work.
I'll show you why.
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