How to make a block that gives you a tool

If the player jumps, TouchEnded fires.

1 Like

Then OP could either let the player not jump when on the button? But that already defeats the purpose of what hes trying to do

He could, but in my opinion I think that using the value method is better.

Thanks for all the help! I will use the bool value.

If you need any further help, please shoot me a private message.

I just found this. @True_Snowi perhaps this can help you. Itā€™s not marked as solved as of writing but I bet the replies already existing can help you.

Alright this is simple script I just made to give it ONCE.
(server)

    script.Parent.Touched:Connect(function(hit)
    local player = game.Players:FindFirstChild(hit.Parent.Name)
    local itemname = "TOOL NAME HERE"
    local tool = game.ServerStorage:FindFirstChild(itemname)
    if player then
    if player.Backpack:FindFirstChild(itemname) then
    print("player has the" .. itemname .." tool already")
    else
    warn("giving ".. toolname .." to ".. player.Name.." backpack's")
    tool:Clone().Parent = player.Backpack
    end
    end
    end)

This next script is when they leave the sword area.
(server)

script.Parent.Touched:Connect(function(hit)
local player = game.Players:FindFirstChild(hit.Parent.Name)
local itemname = "TOOL NAME HERE"
  if player then
    if player.Backpack:FindFirstChild(itemname) then
    print("player has the" .. itemname .." tool, deleteing")
      player.BackPack:FindFirstChild(toolname):Destroy()
    else
    print(player.Name .."Does not have a tool oddly :/")
    end
    end
end)

ps Iā€™m not in studio I could of made a script erorr.

9 Likes

The only errors iā€™ve spotted is the capital P at line 6 of the second script which is supposed to be lowercase and ā€œtoolnameā€ which is supposed to be itemname. Other than that your script works good, you rock!