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
 

Only Good Scripters :P

Previous Thread :: Next Thread 
Coopertow is not online. Coopertow
Joined: 18 Apr 2012
Total Posts: 1959
11 May 2014 06:07 PM
function Click()
mr = math.random(1,4)
tors = script.Parent.Parent.Parent.Parent.Character.Torso
if tors then
if mr == 1 then
tors.CFrame = CFrame.new(-502.238, 1.38, 322.261)
elseif mr == 2 then
tors.CFrame = CFrame.new(-543.996, 1.38, 319.726)
elseif mr == 3 then
tors.CFrame = CFrame.new(-548.895, 1.38, 234.437)
elseif mr == 4 then
tors.CFrame = CFrame.new(-463.249, 1.38, 282.17)
end
end
end

script.Parent.MouseButton1Down:connect(Click)



Can someone edit this I need those positions but it doesnt work
Report Abuse
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
11 May 2014 06:11 PM
is the parent a gui?
Report Abuse
Coopertow is not online. Coopertow
Joined: 18 Apr 2012
Total Posts: 1959
11 May 2014 06:29 PM
Its a teleport GUI
Report Abuse
KAAK82 is not online. KAAK82
Joined: 06 May 2014
Total Posts: 1166
11 May 2014 06:32 PM
from wat I see should be like this;
-ScreenGui -- Classname
--Frame -- Classname
---TextButton -- Classname

so its a GUI>Frame>Button>script
Report Abuse
Foxconn is not online. Foxconn
Joined: 20 Feb 2011
Total Posts: 275
11 May 2014 06:40 PM
I see the problem...

Going off of what KAAK said (the hierarchy) with the script in the TextButton, it should look like this:

function Click()
mr = math.random(1,4)
local game.Workspace[script.Parent.Parent.Parent.Parent.Parent.Name].Torso
if tors then
if mr == 1 then
tors.CFrame = CFrame.new(-502.238, 1.38, 322.261)
elseif mr == 2 then
tors.CFrame = CFrame.new(-543.996, 1.38, 319.726)
elseif mr == 3 then
tors.CFrame = CFrame.new(-548.895, 1.38, 234.437)
elseif mr == 4 then
tors.CFrame = CFrame.new(-463.249, 1.38, 282.17)
end
end
end

script.Parent.MouseButton1Down:connect(Click)
Report Abuse
Coopertow is not online. Coopertow
Joined: 18 Apr 2012
Total Posts: 1959
11 May 2014 06:44 PM
Fox

function Click()
mr = math.random(1,4)


local game.Workspace[script.Parent.Parent.Parent.Parent.Parent.Name].Torso

This line above has red underline...

if tors then
if mr == 1 then
tors.CFrame = CFrame.new(-502.238, 1.38, 322.261)
elseif mr == 2 then
tors.CFrame = CFrame.new(-543.996, 1.38, 319.726)
elseif mr == 3 then
tors.CFrame = CFrame.new(-548.895, 1.38, 234.437)
elseif mr == 4 then
tors.CFrame = CFrame.new(-463.249, 1.38, 282.17)
end
end
end

script.Parent.MouseButton1Down:connect(Click)
Report Abuse
Foxconn is not online. Foxconn
Joined: 20 Feb 2011
Total Posts: 275
11 May 2014 06:56 PM
If the script is TeleGui>Frame>Button>TeleScript

then:

local char = game.Players.LocalPlayer

function Click()
mr = math.random(1,4)
local tors = char.Character.Torso
if tors then
if mr == 1 then
tors.CFrame = CFrame.new(-502.238, 1.38, 322.261)
elseif mr == 2 then
tors.CFrame = CFrame.new(-543.996, 1.38, 319.726)
elseif mr == 3 then
tors.CFrame = CFrame.new(-548.895, 1.38, 234.437)
elseif mr == 4 then
tors.CFrame = CFrame.new(-463.249, 1.38, 282.17)
end
end
end

script.Parent.MouseButton1Down:connect(Click)
Report Abuse
Coopertow is not online. Coopertow
Joined: 18 Apr 2012
Total Posts: 1959
11 May 2014 07:21 PM
Doesnt Work
Report Abuse
Coopertow is not online. Coopertow
Joined: 18 Apr 2012
Total Posts: 1959
11 May 2014 08:32 PM
First one gets 200R Nothing Works Yet
Report Abuse
Coopertow is not online. Coopertow
Joined: 18 Apr 2012
Total Posts: 1959
11 May 2014 11:03 PM
.
Report Abuse
jasondee1 is not online. jasondee1
Joined: 26 Jul 2008
Total Posts: 8002
11 May 2014 11:06 PM
wheres your connector line? theres for mousebutton1down but what connects it when the tool is equipped? (guessing that it is a tool)

you should have something like

function onEquippedLocal(mouse)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end

and then this at the bottom

Tool.Equipped:connect(onEquippedLocal)
Report Abuse
jasondee1 is not online. jasondee1
Joined: 26 Jul 2008
Total Posts: 8002
11 May 2014 11:08 PM
whoops, I look like an idiot again, only read OP, turns out its a GUI, so your not going to need the equipped function. sorry >_<
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
11 May 2014 11:08 PM
..gtg..bump
Report Abuse
C0mmando323 is not online. C0mmando323
Joined: 15 Dec 2012
Total Posts: 394
11 May 2014 11:09 PM
What do you mean "It doesn't work"? Is there an error code line? That would be very helpful.
Report Abuse
jasondee1 is not online. jasondee1
Joined: 26 Jul 2008
Total Posts: 8002
11 May 2014 11:10 PM
Oooh, try turning it (the recently corrected script)from a script into a localscript. LocalPlayer is only available in localscripts
Report Abuse
Coopertow is not online. Coopertow
Joined: 18 Apr 2012
Total Posts: 1959
12 May 2014 12:27 AM
dont get what u mean
Report Abuse
transIate is not online. transIate
Joined: 20 Jun 2013
Total Posts: 2699
12 May 2014 12:37 AM
plr=game.Players.localPlayer.Character;
mr=math.random(1,4);
script.Parent.MouseButton1Down:connect(function()
if(mr==1)then
plr:moveTo(CFrame.new(-502.238,1.38,322.261)); end;
if(mr==2)then
plr:moveTo(CFrame.new(-543.996,1.38,319.726)); end;
if(mr==3)then
plr:moveTo(CFrame.new(-548.895,1.38,234.437)); end;
if(mr==4)then
plr:moveTo(CFrame.new(-463.249, 1.38, 282.17)); end;
end);
Report Abuse
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
12 May 2014 12:39 AM
^

Ignore this guy, his # of # and # freaking semi-colons will drive you crazy.
Report Abuse
KOTwarrior is not online. KOTwarrior
Joined: 13 Jun 2012
Total Posts: 4376
12 May 2014 12:39 AM
if this is good scripters only, why are you here? < BAHAHAHAHAHAHA ; i hav like no idea y i said that

this is a signature: pcall(function() print([[apparently this is a string]]) end)
Report Abuse
crazymuffin267 is not online. crazymuffin267
Joined: 01 Aug 2012
Total Posts: 253
12 May 2014 12:49 AM
Use vector3.new()


-.-
Report Abuse
jasondee1 is not online. jasondee1
Joined: 26 Jul 2008
Total Posts: 8002
12 May 2014 01:52 AM
uh cooper, insert a new localscript, copy and paste your code into it, disable the script you copied from, and place the localscript where the script is. Tell me if it works now.
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
12 May 2014 02:21 AM
function Click()
mr = math.random(1,4)
Plyr = script.Parent
repeat Plyr = script.Parent until Plyr.ClassName == "Player"
tors = Plyr.Character.Torso
if tors then
if mr == 1 then
tors.CFrame = CFrame.new(-502.238, 1.38, 322.261)
elseif mr == 2 then
tors.CFrame = CFrame.new(-543.996, 1.38, 319.726)
elseif mr == 3 then
tors.CFrame = CFrame.new(-548.895, 1.38, 234.437)
elseif mr == 4 then
tors.CFrame = CFrame.new(-463.249, 1.38, 282.17)
end
end
end

script.Parent.MouseButton1Down:connect(Click)



Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
12 May 2014 02:22 AM
http://www.roblox.com/PAYMENT-item?id=155519626
Report Abuse
Foxconn is not online. Foxconn
Joined: 20 Feb 2011
Total Posts: 275
12 May 2014 05:38 PM
ScreenGui>Frame>TextButton>Script
It worked for me.

local char = game.Players.LocalPlayer

function Click()
mr = math.random(1,4)
local tors = char.Character.Torso
if tors then
if mr == 1 then
tors.CFrame = CFrame.new(-502.238, 1.38, 322.261)
elseif mr == 2 then
tors.CFrame = CFrame.new(-543.996, 1.38, 319.726)
elseif mr == 3 then
tors.CFrame = CFrame.new(-548.895, 1.38, 234.437)
elseif mr == 4 then
tors.CFrame = CFrame.new(-463.249, 1.38, 282.17)
end
end
end

script.Parent.MouseButton1Down:connect(Click)
Report Abuse
KAAK82 is not online. KAAK82
Joined: 06 May 2014
Total Posts: 1166
12 May 2014 05:53 PM
cooper, I sent u a PM, read it and u'll get it fixed!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 2Go to page: [1], 2 Next
 
 
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