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: What's wrong with this?

Previous Thread :: Next Thread 
IcyFires is not online. IcyFires
Joined: 29 Jun 2013
Total Posts: 5046
20 Jul 2013 09:15 PM
local debounce = false
function onTouched(hit)
local t = hit.Parent:findFirstChild("Torso")
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if debounce == false then
debounce = true
if plr:IsInGroup(678906) then
game.Workspace.Player.Torso.CFrame = CFrame.new(Vector3.new(4, 3, -139))
wait(3)
debounce = false
end
end
end
script.Parent.Touched:connect(onTouched)
Report Abuse
IcyFires is not online. IcyFires
Joined: 29 Jun 2013
Total Posts: 5046
20 Jul 2013 09:16 PM
bumpitybumpityboo
Report Abuse
IcyFires is not online. IcyFires
Joined: 29 Jun 2013
Total Posts: 5046
20 Jul 2013 09:18 PM
b2
Report Abuse
IcyFires is not online. IcyFires
Joined: 29 Jun 2013
Total Posts: 5046
20 Jul 2013 09:21 PM
In script helpers no one ever helps me ugh
Report Abuse
IcyFires is not online. IcyFires
Joined: 29 Jun 2013
Total Posts: 5046
20 Jul 2013 10:00 PM
b3
Report Abuse
Voidion is not online. Voidion
Joined: 01 Aug 2011
Total Posts: 2668
20 Jul 2013 10:04 PM
plr.Character.Torso.CFrame = CFrame.new(4, 3, -139)
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
20 Jul 2013 10:09 PM
You should use your if statement for your debounce before you start trying to index things.
Also, you should check to see if 'plr' exists before accessing it.
Instead of checking for the Torso, you can just use the MoveTo method on the Character model.
You messed up when indexing the Torso, the second time. Instead of using that variable, you tried accessing something that may or may not exist in Workspace.

local debounce = false

function onTouched(hit)
if debounce == false then
debounce = true
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr and plr:IsInGroup(678906) then
plr.Character:MoveTo(Vector3.new(4, 3, -139))
wait(3)
end
debounce = false
end
end

script.Parent.Touched:connect(onTouched)
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
20 Jul 2013 10:09 PM
Oh, sorry. Also, try not to bump your topic until after it's no longer on the first page. Scripting Helpers isn't THAT active. xD
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