|
| 19 Jun 2014 10:02 PM |
so im using a weld, and well... heres what i have:
local weld = Instance.new("Weld",plr.Character.Torso) weld.Part0 = weld.Parent weld.Part1 = b weld.C1 = CFrame.new(0,-1,0) * CFrame.Angles(math.rad(-90),0,0)
so that works fine and dandy, and no errors there, the only issue that is bugging me is i cant set the 'weld.C1' to this:
weld.C1 = CFrame.new(math.random(-0.5,0.5),-1,math.random(-0.5,0.5)) * CFrame.Angles(math.rad(-90),0,0) (chaning the 0's to the math.random(-0.5,0.5)'s)
if i do that, then it wont register the math.random at all and just keep it at '0,-1,0' but when i change the 0.5's to whole numbers:
weld.C1 = CFrame.new(math.random(-1,1),-1,math.random(-1,1)) * CFrame.Angles(math.rad(-90),0,0)
then the math.random is registered and works. Is there any way to fix this? (the parts are on a 'Custom' formFactor if it makes a difference) |
|
|
| Report Abuse |
|
|
| |
|
|
| 19 Jun 2014 10:06 PM |
fo real homie :l
i have no clue what could be causing this either .-. |
|
|
| Report Abuse |
|
|
Forlapse
|
  |
| Joined: 07 Jan 2014 |
| Total Posts: 122 |
|
|
| 19 Jun 2014 10:11 PM |
| Correct me if Im wrong, but dosnt math.random only select whole integers? |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 10:11 PM |
| never really worked with math.random but i dont think it can accept negative integer arguments |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 10:11 PM |
| *I mean accept more than 3 arguments |
|
|
| Report Abuse |
|
|
Forlapse
|
  |
| Joined: 07 Jan 2014 |
| Total Posts: 122 |
|
|
| 19 Jun 2014 10:15 PM |
So at that you might have to do:
x=math.random(-0.5,0.5) y... z...
But Im pretty sure it always returns as a whole number so try this: math.random(-0.5,0.5)*100 http://wiki.roblox.com/index.php?title=Math.random |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 10:15 PM |
well...
math.random(); the way im using it takes two arguements, the smallest first followed by the largest, and i know for a fact that it does work with negative integers, but you may be right forlapse, in assuming it only works with whole number integers... :l |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 10:16 PM |
welp looks like i have to do this the hard way >.>
loops your supposed to be able to save me hard work not expand it ;_; |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 10:19 PM |
Math.random can only accept 2 arguments. Not 3. It can't be something like math.random(1,10,15) Only math.random(1,10) |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 10:21 PM |
@Dh, i already knew this, i didnt have 3 arguements entered for the math.random() i had 3 arguments entered for the CFrame Value of the Welds 'C1' |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 11:05 PM |
print(math.random(-.5,.5)) --won't work print(math.random(-5,5)/10) --same thing, should work
math.random can only be used with integers, but you can use math to make it seem like it is getting a decimal |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 11:08 PM |
math.random(-.5,.5) --Nope.
math.random()-0.5 --Yup. |
|
|
| Report Abuse |
|
|