Это видео недоступно.
Сожалеем об этом.
Roblox Studio Tutorial: Touch For Points
HTML-код
- Опубликовано: 21 май 2020
- In this video I show you how to add a touch for points system in your Roblox Studio game! With this, players can touch a part to earn points, money, or whatever else you'd like! I also show you how to add a custom cool down time for your part to control how much players can earn at a time.
Other Videos in Series:
Click for Points: • Roblox Studio Tutorial...
Link to Code:
www.mrmichaels...
»Join the Discord Server!
/ discord
There are many tutorials on using touch, but this one was a needle in the haystack to find. This bridges the "part" and "humanoid" touch with managing a score/coin solution. Very clean code and clearly explained. Thank you
yes
Thanks! I'm making an obby and wanted people to earn a point whenever they completed a stage. And I'm so glad that you put the code in the description, because I typed it wrong at first, but then I saw the link in the description and it really helped! Thanks for making this video!
Same!
same thing im doing!!!!
The tutorial is so simple, easy to understand, and fun to watch =D keep up the great work!
Here the scripts in the video:
(first script):
local function onPlayerJoin(player)
local leaderstasts = Instance.new('Folder')
leaderstasts.Name = 'leaderstats'
leaderstasts.Parent = player
local coins = Instance.new('IntValue')
coins.Name = 'Coins'
coins.Value = 0
coins.Parent = leaderstasts
end
game.Players.PlayerAdded:Connect(onPlayerJoin)
here the second script:
local part = script.Parent
local canGet = true
local function onTouch(otherPart)
local humanoid = otherPart.Parent:FindFirstChild('Humanoid')
if humanoid then
local player = game.Players:FindFirstChild(otherPart.Parent.Name)
if player and canGet then
canGet = false
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 1
wait(3)
canGet = true
end
end
end
part.Touched:Connect(onTouch)
@@pokecrafterc461 THIS IS WHO WE NEED!!!!!!!!! THANK YOU MAN YOU ARE MY HERO!!!!
Tysm bro
Thank you, i must have missed something but couldn't find it, and this comment worked :)
second script
local part = script.Parent
local canGet = true
local function onTouch(otherPart)
local humanoid = otherPart.Parent:FindFirstChild('Humanoid')
if humanoid then
local player = game.Players:FindFirstChild(otherPart.Parent.name)
if player and canGet then
canGet = false
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 10
wait(100 000 000)
canGet = true
end
end
end
part.Touched:Connect(onTouch)
So I wanted to post the script because I had to make some small adjustments for it to work for me in the more recent version of Roblox Studio. And instead of coins I did points. You can go in and change it to coins or money if you wanna. Also, thank you so so so much for this script! Here it is!
*SCRIPT ONE:*
local function onPlayerJoin(player)
local leaderstats = Instance.new('Folder')
leaderstats.Name = 'leaderstats'
leaderstats.Parent = player
local points = Instance.new('IntValue')
points.Name = 'Points'
points.Value = 0
points.Parent = leaderstats
end
game.Players.PlayerAdded:Connect(onPlayerJoin)
*SCRIPT TWO:*
local part = script.Parent
local function onTouch(otherPart)
local humaniod = otherPart.Parent:FindFirstChild('Humaniod')
if humaniod then
end
local player = game.Players:FindFirstChild(otherPart.Parent.Name)
if player then
end
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 1
end
part.Touched:Connect(onTouch)
where would you add the wait(3) in this script?
@@DJ_week fr
@@DJ_week hey so the wait(1000) goes under the player.leaderstats.Points.Value = player.leaderstats.Points.Value + 1 part
Thanks!
Finaly somone to help us, thank u so much!
Tech please i mean please make a video on "how to may a sky-diving animation to your character when the character touches a part". I will be so grateful you wont understand. You could also just make a video on "how to make character animations triggered when you touch a part". It would help a ton of ppl trust me!
try putting this script in the part:
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local Humanoid = hit.Parent:FindFirstChild("Humanoid")
Humanoid:LoadAnimation(insert animation ID here)
--Put the ID of the animation in the brackets of the line above.
end
end)
This was super helpful thank you so much this is honestly one of the best ROBLOX studio tutorials I’ve seen
THANK YOU SO SO SOOOOO MUCH, EVERYBODY WHO THINKS THIS VIDEO ISNT TRUE THEN READ THIS COMMENT, THIS IS 100% TRUE THANK YOU SO MUCH NOW IM ABLE TO WORK ON MY GAME MORE! i subbed too
Awesome thanks!
i cannot thank you enough for this video
Thank you so much I've been trying to find a video that tells me how to do this for years, my friends and even my brothers thought my game would be useless without currency in the game. Thank you so so so much!
if you need help with enything else tell me maybe ik
You are like the next level genius in coding for me, thank you soo much for this tutorial also can you make a video on how to make a key and door but then if I don't have the key equipped but it's in my inventory and instead of making the key touch the door to unlock can you click in the door with the correct key to unlock it, thnx!
bro holy thank you so much. My sped ass couldn't didn't know how to do this since I'm a beginner Developer. Can't thank you enough homie
Thank you so much
How to make it only 1 time if you leave
you got a new subscriber!
thank you, i handled that easily with a starter knowledge on scripts
thank this is very useful for creator/developer
thanks so much! I also needed this for my speedrun game! here's a like and subscribe!
Thanks!
:D ty
@@TechwithMikeYT Can I ask you to make touch to get points but client-sided to avoid players getting multiple points?
amazing tutorial im subscribing
Thanks 😁
OMG OMG THX THX THX THX YOH ARE THE BEST
RUclipsR EVER THX SO MUCH ITS THE BEST TUTORIAL! :D
OMG THX!! IT RLLY WORKED I RLLY WAS LOOKING FOR THIS TUTORIAL THXX
YOU ARE THE ONLY ONE THAT TELL HOW TO DO IT, THX!!
u rly helped me a lot xd im making leaderstats with gaining points if touched and ye thanks for this tut
Glad I could help!
@@TechwithMikeYT im happy to say that i made my frist roblox game :D
www.roblox.com/games/5849459665/Obby-Dummy-Test-2020?refPageId=e0037045-0b02-4d3f-bd95-9457df8b7d57
Thank you, I need this for my school
Amazing helpful video! And I'm on mobile and the video quality is great so I can actually read stuff.
LOL THERE IS NO STUDIO ON MOBILE DUMBASS!
how do u make it that when a player touches it they cant touch the part again but other players who did not touch it can touch it and get points
when I shoot at a target I want to score points but I dont know how to do this
THANK YOU VERY MUCH, I GOT A LOGICAL ERROR IN MY GAME FROM THE TOUCH EVENT, BUT YOU SAVED ME!!!
you deserve 1m subs ty for teaching me :,)
script 2:
local part = script.Parent
local function onTouch(otherPart)
local humanoid = otherPart.Parent:FindFirstChild('Humanoid')
if humanoid then
local player = game.Players:FindFirstChild(otherPart.Parent.Name)
if player then
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 1
end
end
end
part.Touched:Connect(onTouch)
i hope you win the lottery you get all the women!!??!
Thanks bro i really needed this for my simulator game. Keep up the good work :)
Glad I could help
@@TechwithMikeYT it didn't work for me
For some reason my it doesn’t increase my points when I touch it
Same
Did you use a different leaderstat value
@@TechwithMikeYT YES.
@@juska103oldaccount if you use a different leaderstat then you would need to update the code. For the leaderstat script and the script in the part.
How do i make it not only one can touch it and get coins i want that other players dont have to wait if the other one touches it
every comment aside lets just appreciate this guy in the beginning touched that part 55 times
bro tysm this video was very useful and i really needed the scripts for my game
is there a way I could make it certain things (like player or vehicle) can't score, but others can (like a ball)
It works perfectly you just earned a sub!
tysm this helped me a lot!
i figured out my issue thanks tho
u deserve ALOT more subs :)
Oh turns out the fix didnt work the game just broke and made it work so not its broken again :(
Nice job!
OMG, Thanks! :D
TY helped so much
how to make this but if i touched its invisible
?
THANK YOU SO MUCH!!
How to make that just for team colour = red or team criminal??
That is what i want to know :c
The leaderboard shows, but when I touch the part, it does not increase my points! please help.
DOUBLE CHECK YOUR SCRIPTS
@@javegaming28 yh lol
IT WORKS DOUBLE CHECCKKCC
How do you make it so it saves the points? Also is there a way after someone touches it, they get teleported back to the lobby
Data store
ruclips.net/video/-wAJAI95ivs/видео.html
Teleport
ruclips.net/video/3PgVbkRgNsY/видео.html
Tech with Mike thanks !
tysm!
AMAZINGLY HELPFUL!!!
I dont know if you will see this, but how would is script a part to give you a point, disappear for x amount of seconds and then reappear?
Tysm this worked for me first try 😭
*This script goes on serverscriptservice:*
local function onPlayerJoin(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local coins = Instance.new("IntValue")
coins.Name = "Coins"
--You can change the name to literaly anything
coins.Value = 0 --Initial values of coins
coins.Parent = leaderstats
end
game.Players.PlayerAdded:Connect(onPlayerJoin)
*And this goes in your part*
local part = script.Parent
local canGet = true
local function onTouch(otherPart)
local humanoid = otherPart.Parent:FindFirstChild('Humanoid')
if humanoid then
local player = game.Players:FindFirstChild(otherPart.Parent.Name)
if player and canGet then
canGet = false
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 1
--You can make it to add more of 1
wait(10) --This says how much tie to wait till script valid again, It says 10 but you can change it to anthing,
canGet = true
end
end
end
part.Touched:Connect(onTouch)
*Ok i helped yall guys, now help me please*
*I want to make that the script is only valid if you are from red team. Please help meeehhhh*
yay tank
can you do when you seat you actually getting points without moving?
that would be helpful for my game
this is really helpful for my tower of hell game
:o
:O
does the points save?
@@craigstone5931 yes it does.
my good man, you just earned a sub. :D
Awesome, thank you!
Helped me with my game but can you make a video about how to put a GUI that shows your currenct I want ut for mobile
go starter gui add screen gui add text label add local script
script:
wait(2)
while true do
wait()
script.Parent.Text = ""..game.Players.LocalPlayer.leaderstats.Coins.Value
end
@@user-vz6sr1lf7k oof I don’t need it anymore I just needed it for my tower of hell game with randomizing stages and I wanted to also add a shop with gears and I already did it
Thank you so much!
local part = script.Parent
local function onTouch(otherPart)
local humanoid = otherPart.Parent:FindFirstChild('Humanoid')
if humanoid then
local player = game.Players:FindFirstChild(otherPart.Parent.Name)
if player then
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 100
end
end
end
part.Touched:Connect(onTouch)--ur welcome :))))))
TYSM
Spent like 20 minutes thinking that this was a waste of time until I realized I needed to capitalize the P in parent😭
omg thx i made a obby and then when u touch the checkpoint u get = 1 stage
why does it stop working when i publish the game?? it works fine in testing and in the output it says it’s not a member of player leaderstats
you helped me out so much mate
Thanks!
my personal script for this:
local part = script.Parent
local canGet = true
local function onTouch(otherPart)
local humanoid = otherPart.Parent:FindFirstChild(‘Humanoid’)
if humanoid then
local player = game.Players:FindFirstChild(otherPart.Parent.Name)
if player and canGet then
canGet = false
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 5
wait (0.7)
canGet = true
end
end
end
part.Touched.Connect(onTouched)
i put the script as local script for the part be cause if it someone touches it with a normal script it will give everybody some points so i did a local script
how to make that when you touch a part, a player will get point but can't get it ever again.
You made this but my question is:
How to make other players get point and you cannot get any more points.
Thank You So much, I got it set up in 20 Seconds
THANK YOU .... YOU SAVED MY GAME
how to I make it so it saves?
can u make it like if u touch 1 part, u get coins ONLY once not anymore
you just have to remove the can touch = true at the end
make it wait(10000000000000000000000000000000000000000000000000)
@@user-vz6sr1lf7k or what this person said
Is it able to save when leave ?
Here is the first script:
local function onPlayerJoin(player)
local leaderstasts = Instance.new('Folder')
leaderstasts.Name = 'leaderstats'
leaderstasts.Parent = player
local coins = Instance.new('IntValue')
Wins.Name = 'coins'
Wins.Value = 0
Wins.Parent = leaderstasts
end
game.Players.PlayerAdded:Connect(onPlayerJoin)
Second script:
local part = script.Parent
local canGet = true
local function onTouch(otherPart)
local humanoid = otherPart.Parent:FindFirstChild('Humanoid')
if humanoid then
local player = game.Players:FindFirstChild(otherPart.Parent.Name)
if player and canGet then
canGet = false
player.leaderstats.coins.Value = player.leaderstats.coins.Value + 1
wait(5)
canGet = true
end
end
end
part.Touched:Connect(onTouch)
good tutorial worked for me
Mike, how can i make two seperate teams that if was touched, would give a goal to one team and if scored a goal on the other side would give points to the other team? Thanks.
P.S it also doesnt work for me. Or like instead of a player needed to touch it, a part?
how to make it not over do it? like if i click the part it gives me a point and if i do it again it will give me a point, how can i make it not over do it?
yo can anyone help me it doesn't work
so how do i do it like when two people step on the same part but only one person gets the point . How do i fix that ?
How do i make it like a jailbreak bank vault where it constantly give u cash?
Great tutorial
Can you make version with autosave, so if people leave and join back, they will still have the amount?
I need this one too
@@thewillyjeff1371 its pretty easy to make if you still need it i can help you if you need too
@@user-vz6sr1lf7k yes
@@justinaraboghli5784 i can give you the script can you tell me the currency of your game?
(AKA. Coins, Cash, Money, Gems idk)
@@user-vz6sr1lf7k yes Cash
its not working pls help me
6:16 saving my time
hello is their a way to make it that you only get the points if you have special a part with you then the part disappears.
This is so gosh darn helpful. I liked and I subbed but my only question is how can I make it so each player can only collect a point 1 time?
add a part.Script.Disabled = true in the function
like this:
local part = script.Parent
local canGet = true
local function onTouch(otherPart)
local humanoid = otherPart.Parent:FindFirstChild('Humanoid')
if humanoid then
local player = game.Players:FindFirstChild(otherPart.Parent.Name)
if player and canGet then
canGet = false
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 1
wait(3)
canGet = true
part.Script.Disabled = true
end
end
end
part.Touched:Connect(onTouch)
@@royalphrog TYSM
@@royalphrog 3 months late but thanks
But i want to know how can more players get coins, if i set debounce to false at the end other players won't get them, just the one who touched them and no one after
that so great tq
thanks you
Hey Mike! I'm just wandering why my crystals aren't working? I've deleted everything I'd done in the video and tried again twice! It's still not working. And I've got the 2 lines of script you said. Nothings worked. Any help?
Can you make it so its like a ball/part touch's it and gives point and not player? need it for a sports game
how to convert this into interact with.
Like for example.
If player interact with dialogue (name)
Gets Coin
I am realy bad at coding just started today with my first project. Hope some one can help
thanks bro
WOW this is really helpful thank you so much! is there a way tho that you can make a area that this brick can spawn in and if you hit it it just disappears
How can I make if model touch the part, add a coins but not player?
How to make the coins to save when players leave ?
How do I make it so that instead of waiting 3 seconds you respawn please help!
how do I do this but like with dying, like when you die you get it?
Thx so much finally one that worked but can u pls show how to do auto save with this script
Hello can you please make like a tool and where you click to shoot something like a ball and the ball will spawn 100 studs in front of the player and then it will go where your cursor is
Hi, how do you make it so the players can only receive a point from the block once? I am making an obby and I want to make it so when a player touches the checkpoint they are awarded 10 coins. I don't want a player to be able to collect the bonus more than once. Is there a way to make it so each player in the game is only allowed to collect the bonus once?
local part = script.Parent
local canGet = true
local function onTouch(otherPart)
local humanoid = otherPart.Parent:FindFirstChild('Humanoid')
if humanoid then
local player = game.Players:FindFirstChild(otherPart.Parent.Name)
if player and canGet then
canGet = false
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 10
end
end
end
@@user-vz6sr1lf7k it did not work
hey, so i tried the first script and idk if its right cuz it havent worked...