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

What Script do I use to touch a brick to give me a gear? [closed]

Asked by 5 years ago

I have been trying the old script

0101  local debounce = false
0202  
0303  function getPlayer(humanoid)
0404  local players = game.Players:children()
0505  for i = 1, #players do
0606  if players[i].Character.Humanoid == humanoid then return players[i] end
0707  end
0808  return nil
0909  end
1010  
1111  function onTouch(part)
1212  
1313  local human = part.Parent:findFirstChild("Humanoid")
1414  if (human ~= nil) and debounce == false then
1515  
View all 30 lines...

This is the one that doesn't work.

So I tried fixing it but it still didn't work. Can you help me?

0
"the old script" This is not free model support. You have not shown any attempt to debug it or explain how it works, and also have provided code with deprecated methods. I have marked this as non-constructive and off-topic as this is not for free model help nor will we make a model for you hiimgoodpack 2009 — 5y

Closed as Not Constructive by hiimgoodpack and royaltoe

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

3 answers

Log in to vote
0
Answered by 5 years ago

Change line 22 to something to point to where you have your gear such as serverstorage...

1game:GetService("ServerStorage").YOURGEAR:clone().Parent = player.Backpack
1
Oh so I needed to get service to server storage? NotFrindow 346 — 5y
1
Not really, you can put the gear you want to clone where ever you want it. I typically store stuff in server storage as opposed to workspace so it doesn't get picked up or something kangerujack 20 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

What your going to have to do is detect when the part is touched on the server, then clone a tool to their backpack (or character for instant equip).

01local Player = game:GetService('Players')
02 
03local Tool = script.Tool -- Put the tool in the script
04local Part = workspace.Part -- Define the part here
05 
06local Debounce = false
07 
08Part.Touched:Connect(function(Obj)
09    if Debounce then return end
10    Debounce = true
11    local Player = Players:GetPlayerFromCharacter(Obj.Parent)
12    if Player then
13        Tool:Clone().Parent = Player.Backpack
14        wait(1)
15        Debounce = false
16    end
17end)
Log in to vote
0
Answered by 5 years ago

use the toolbox