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

How do i make an item heal and give speed?

Asked by 4 years ago

ok so basically i need to make an item that heals max hp, adds 10 to your walkspeed, and has a 60 second cooldown, but i have no idea what the script would be, could somebody help?

0
function onTouch(hit) hit.Parent.Humanoid.WalkSpeed = 35 hit.Parent.Humanoid.Maxhealth = 200 hit.Parent.Humanoid.Health = 100 end script.Parent.Touched:connect(onTouch)   Powergamepro102 0 — 4y
0
function onTouch(hit) hit.Parent.Humanoid.WalkSpeed = 35 hit.Parent.Humanoid.Maxhealth = 200 hit.Parent.Humanoid.Health = 100 end script.Parent.Touched:connect(onTouch) wait(60) hit.Parent.Humanoid.WalkSpeed = 45 Powergamepro102 0 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Starting of with your question.

I'm not sure what you're referring to as an 'item' but i'm going to guess a tool, so you're going to start of with utilizing the Tool Activated function for every time you're going to click and you'll need to be retrieving the players Humanoid to access it's properties which you'll be needing.

The property MaxHealth for Humanoid is a float, and you'll be able to change it by doing simply

Humanoid.MaxHealth = 100 -- Since you were asking for it to 'heal max hp' 

Now finally we have walkspeed, for that you'll just be doing something similar.

Humanoid.Walkspeed = Humanoid.Walkspeed + 10 -- Adds 10 each time.

So we're at the conclusion where you'll need to attach the pieces together and you'll have your resulting code for it. If you're needing further help you'll need to refer to the Roblox API Reference Manual or another member can do it for you as I wont be providing the result code as you wouldn't be 'learning' from it.

I hope you've understood a bit!

Ad

Answer this question