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 » Scripters
Home Search
 

POINT SYSTEM

Previous Thread :: Next Thread 
dockboy20006 is not online. dockboy20006
Joined: 14 Feb 2011
Total Posts: 251
30 Jun 2016 03:20 PM
I'm making a point system so if you're driving the car and the car touches it, the points transfer to you. But when the car touches it, the points don't transfer to your leaderstats. Any help?
Report Abuse
kools is not online. kools
Joined: 11 Jan 2009
Total Posts: 1659
30 Jun 2016 03:22 PM
We need code posted. A good rule of thumb for this forum is to post errors, unexpected behavior, and code when asking a question about something not working.
Report Abuse
dockboy20006 is not online. dockboy20006
Joined: 14 Feb 2011
Total Posts: 251
30 Jun 2016 03:28 PM
I don't know the script...
Report Abuse
kools is not online. kools
Joined: 11 Jan 2009
Total Posts: 1659
30 Jun 2016 03:35 PM
Are you asking how to do this, because the statement: "But when the car touches it, the points don't transfer to your leaderstats" sort of implied that there was already a system in use. Unless you are describing the way you want it to be?
Report Abuse
dockboy20006 is not online. dockboy20006
Joined: 14 Feb 2011
Total Posts: 251
30 Jun 2016 03:47 PM
Yes there is one. But the script is only directed to when the player touches it. I need to know how to make it when the car touches it the points transfer to your leaderstats.

Here are the scripts I am using

function onTouched(part)
part:Remove()
end
script.Parent.Touched:connect(onTouched)



Another 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 points = stats:findFirstChild("Points")
points.Value = points.Value +150
wait(1)
end

end

ting = 0
end

end

script.Parent.Touched:connect(onTouched)
Report Abuse
iDerpyDogez is not online. iDerpyDogez
Joined: 05 Feb 2012
Total Posts: 1781
30 Jun 2016 04:24 PM
why two? arent they both for the same thing?


#code while true do end
Report Abuse
kools is not online. kools
Joined: 11 Jan 2009
Total Posts: 1659
30 Jun 2016 04:27 PM
What we will do is in addition to checking if there is a humanoid, we can also check for a VehicleSeat, and get the occupant property that will supply us with the humanoid.

local ting = 0

function onTouched(hit)

if ting == 0 then
ting = 1
humanoid = hit.Parent:FindFirstChild("Humanoid")
vehicleseat = hit.Parent:FindFirstChild("VehicleSeat")
if vehicleseat then -- Be sure to keep VehicleSeats named VehicleSeat otherwise this would be more complex.
humanoid = vehicleseat.Occupant
end

if humanoid then

local user = game.Players:GetPlayerFromCharacter(humanoid)
local stats = user:findFirstChild("leaderstats")

if stats ~= nil then
local points = stats:findFirstChild("Points")
points.Value = points.Value +150
wait(1)
end

end

ting = 0
end

end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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