Hello! I am creating sword arena (I'm scripting beginner) and I already did "teleport on touch". This brick teleports you to Arena, but I want to add, that, when you touch brick, you'll get "Sword" (Classic by Roblox),
so please, help me with script and also, where to put Sword in Explorer and all these scripts :)
Thank you, if you need more information, ask me!
Also code, which's already in that brick: local part = script.Parent
local part = script.Parent part.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Head.CFrame = CFrame.new(-416, 77.9, 187.6) end part.BrickColor = BrickColor.new("Black") wait(0.2) part.BrickColor = BrickColor.new("White") end)
Here this is an example of what you would want:
local sword = script.Parent.Sword local brick = script.Parent
brick.Touched:Connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- Try to find the player from the character. if player then if player.Backpack:FindFirstChild(sword.Name) then return end -- Do nothing if we find the sword in their backpack. local clone = sword:Clone() clone.Parent = player.Backpack end end)