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: Sticky Brick?

Previous Thread :: Next Thread 
opplo is online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
23 Feb 2011 08:48 AM
How would you make a brick stick to another on touch. It cant anchor ontouched.

Help would be greatly appretiated i,ve been trying to do this for months and i just cant figure it out.
Report Abuse
ellosss is not online. ellosss
Joined: 15 Mar 2009
Total Posts: 7030
23 Feb 2011 08:58 AM
local brck=script.Parent

brck.Touched:connect(
function(hit)
if hit.Parent then
local w=Instance.new("Weld",hit)
w.Part0=hit
w.Part1=brck
w.C0=hit.CFrame
w.C1=brck.CFrame
end
end)
Report Abuse
ellosss is not online. ellosss
Joined: 15 Mar 2009
Total Posts: 7030
23 Feb 2011 09:07 AM
mmhm.. >.>
Report Abuse
opplo is online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
23 Feb 2011 09:18 AM
are you sure that works?
Report Abuse
opplo is online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
23 Feb 2011 09:57 AM
bump.
Report Abuse
razourik is not online. razourik
Joined: 21 Jan 2009
Total Posts: 1155
23 Feb 2011 10:09 AM
I think that code will work :D But the sticky brick needs to be named "brck" because he wasn't quite smart enough to spell "brick" XD
Report Abuse
opplo is online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
23 Feb 2011 10:16 AM
it doesnt matter what he spells that as.
Report Abuse
opplo is online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
23 Feb 2011 10:45 AM
bump anyone think it doesnt work?
Report Abuse
justasimpletest is not online. justasimpletest
Joined: 07 Feb 2011
Total Posts: 733
23 Feb 2011 10:53 AM
function onTouched(hit)
local h = hit.Parent:FindFirstChild("Humanoid")
if h then
h.Parent.Anchored = true
end
end
Report Abuse
opplo is online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
23 Feb 2011 10:54 AM
omg u noob.
Report Abuse
leolion113 is not online. leolion113
Joined: 11 Oct 2008
Total Posts: 3336
23 Feb 2011 10:55 AM
No offence oppolo but why dont you try it out by yourself ? Also Just read what he wanted to know at the top, the script you posted wouldnt work aswell.
Report Abuse
opplo is online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
23 Feb 2011 10:59 AM
Beacause im busy in a game with someone so i cant go test it also whos wouldnt work?
Report Abuse
leolion113 is not online. leolion113
Joined: 11 Oct 2008
Total Posts: 3336
23 Feb 2011 11:01 AM
Justa's ... It has no connection line, and it isnt following what you was asking ...
Report Abuse
AK7B2A is not online. AK7B2A
Joined: 09 Jan 2009
Total Posts: 395
23 Feb 2011 11:04 AM
tell the guy you don't know if you don't
Report Abuse
opplo is online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
23 Feb 2011 11:09 AM
I know but would the other guys work?
Report Abuse
Robert00001 is not online. Robert00001
Joined: 15 May 2010
Total Posts: 7965
23 Feb 2011 11:20 AM
Put this in the part:
function stick(x,y)
weld = Instance.new("Weld")
weld.Part0 = x
weld.Part1 = y
local HitPos = x.Position
local CJ = CFrame.new(HitPos)
local C0 = x.CFrame:inverse() *CJ
local C1 = y.CFrame:inverse() * CJ
weld.C0 = C0
weld.C1 = C1
weld.Parent = x
end

function onTouched(hit)
stick(hit,script.Parent)
end

script.Parent.Touched:connect(onTouched)
Report Abuse
WK100 is not online. WK100
Joined: 13 Oct 2008
Total Posts: 2835
23 Feb 2011 11:27 AM
Why don't you learn to script, read the script and find out?
Report Abuse
Robert00001 is not online. Robert00001
Joined: 15 May 2010
Total Posts: 7965
23 Feb 2011 11:31 AM
Who are you talking to?
Report Abuse
opplo is online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
23 Feb 2011 11:33 AM
WK100 "Scripting Helpers"
Report Abuse
ellosss is not online. ellosss
Joined: 15 Mar 2009
Total Posts: 7030
23 Feb 2011 11:41 AM
My script works fine. Just put the script in the part you want to be sticky. ^^
Report Abuse
justasimpletest is not online. justasimpletest
Joined: 07 Feb 2011
Total Posts: 733
23 Feb 2011 01:18 PM
Yeah forgot connection line!
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