Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i do so when someone touches a brick with a tool it gives the character EXP?

Asked by 6 years ago

My script does that when i touch it, the brick becomes invisible, but im having trouble with the second part.

Here my script:

script.Parent.Touched:Connect(function(hit) if hit.Parent.Name == "WaterEssence" then script.Parent.Transparency = 0.5 wait(20) script.Parent.Transparency = 0 end

0
You need a variable somewhere in your code so you can increment it. MooMooThalahlah 421 — 6y

2 answers

Log in to vote
0
Answered by
Leamir 3138 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

Hello, SuperBeeperman!

This script will work

script.Parent.Touched:Connect(function(hit)
    if game.Workspace:FindFirstChild(hit.Parent.Name) then
        if game.Workspace:FindFirstChild(hit.Parent.Name):FindFirstChild("WaterEssence") then
        script.Parent.Transparency = 0.5 
        wait(20) 
        script.Parent.Transparency = 0 
end

Notes:

1 - You don't test for the Tool Name, you test if the player that touched have the item in its Model(Player ir holding) or if have on its backpack(Not holding)

Good Luck With your games!!

0
Yes but the thing that I was asking is that if you could give me the script that when I touch the brick with the tool it will give EXP, SuperBeeperman 30 — 6y
0
I don't know what is "EXP", is it a Leaderstats? Leamir 3138 — 6y
0
no, it is an intvalue in a folder named leaderstats SuperBeeperman 30 — 6y
0
Use .value to get a Value`s Value Leamir 3138 — 6y
Ad
Log in to vote
-1
Answered by 6 years ago

The thing that I need is just the script to when I touch the brick with the tool it gives EXP

The script that I posted is working well, now I just need to know how to add so I can get EXP when that triggers.

So the thing that I need is that you add this script the function that gives EXP to the player

Am I being clear? Sorry if not, I’m a bit new at scripting

Answer this question