|
| 08 Nov 2011 08:42 AM |
I have this script, and was trying to make a gui button, that randomly chooses one of the five bricks that you would be teleported to.
--Script
char = script.Parent.Parent.Parent.Parent.Parent.Character tele = game.Workspace.Teleporters
function Click() number = math.random(1,5) if number == 1 then char.Torso.CFrame = tele.One.CFrame end if number == 2 then char.Torso.CFrame = tele.Two.CFrame end if number == 3 then char.Torso.CFrame = tele.Three.CFrame end if number == 4 then char.Torso.CFrame = tele.Four.CFrame end if number == 5 then char.Torso.CFrame = tele.Five.CFrame end end
script.Parent.MouseButton1Down:connect(Click)
--I don't know what's wrong. Probably everything =/
|
|
|
| Report Abuse |
|
|
|
| 08 Nov 2011 08:53 AM |
T = { "One", "Two", "Three", "Four", "Five" } char = script.Parent.Parent.Parent.Parent.Parent.Character tele = workspace.Teleporters function Click() telepick = T[math.random(1, #T)] char.Torso.CFrame = tele[telepick].CFrame end script.Parent.MouseButton1Down:connect(Click)
--**WIN** |
|
|
| Report Abuse |
|
|
|
| 08 Nov 2011 09:01 AM |
| Hmm, looks good, but it doesn't work for me. Thanks for your time though. |
|
|
| Report Abuse |
|
|
|
| 08 Nov 2011 09:04 AM |
| You messed up on your parenting probably, check over it. |
|
|
| Report Abuse |
|
|
| |
|
|
| 08 Nov 2011 09:13 AM |
| Haha, added an extra .Parent to char. Thanks again Thunder. |
|
|
| Report Abuse |
|
|
| |
|