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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: OnTouch Give Points

Previous Thread :: Next Thread 
TheGoldenToilet is not online. TheGoldenToilet
Joined: 23 Apr 2011
Total Posts: 124
03 Mar 2014 06:57 AM
So I'm pretty new to scripting and I made this script:

local ting = 0
function onTouched(hit)
if ting == 0 then
ting = 1
check = hit.Parent:FindFirstChild("Humanoid")
if check ~= nil then
local user = game.Players:GetPlayerFromCharacter(hit.Parent)
local stats = user:findFirstChild("leaderstats")
if stats ~= nil then
local cash = stats:findFirstChild("Points")
cash.Value = cash.Value +10
game.Workspace.Player.Torso.CFrame = CFrame.new(Vector3.new(-34.2, 1.7, -57.8))
wait(0.5)
end
end
ting = 0
end
end

--Events

script.Parent.Touched:connect(onTouched)

---------------------------------------------------

Normally, when you touch the brick that the script is inserted in, it gives you 10 points and it teleports you to (-34.2, 1.7, -57.8) + remove the debounce if necessary.
Could you tell me what's wrong?
Report Abuse
YumERAGON is not online. YumERAGON
Joined: 18 Apr 2012
Total Posts: 3893
03 Mar 2014 07:00 AM
You don't need CFrame AND vector3

and just do MoveTo on the character
Report Abuse
TheGoldenToilet is not online. TheGoldenToilet
Joined: 23 Apr 2011
Total Posts: 124
03 Mar 2014 07:23 AM
Ok thanks. But that still doesn't fix the problem.
Report Abuse
YumERAGON is not online. YumERAGON
Joined: 18 Apr 2012
Total Posts: 3893
03 Mar 2014 07:25 AM
You never actually said what to problem is

1: output
2: what you want to happen
3: what actually happens
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
03 Mar 2014 08:15 AM
game.Workspace.Player.Torso.CFrame = CFrame.new(Vector3.new(-34.2, 1.7, -57.8))

-_-

hit.Parent.Torso.CFrame = CFrame.new(-34.2,1.7,-57.8)


Also if I would use a decoy deploy on that, a clone enemy or npc touches it, it brakes.
Report Abuse
TheGoldenToilet is not online. TheGoldenToilet
Joined: 23 Apr 2011
Total Posts: 124
03 Mar 2014 11:22 AM
Output: Nothing
What I want to happen: Teleport the player and give him 10 points (The one that touches the brick)
Report Abuse
FreeScriptMaker is not online. FreeScriptMaker
Joined: 29 Nov 2013
Total Posts: 2275
03 Mar 2014 11:27 AM
tl;dr
Report Abuse
ObsessedwithMario is not online. ObsessedwithMario
Joined: 03 Mar 2012
Total Posts: 268
03 Mar 2014 12:44 PM
^
|
-_-
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