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

Why won't this put a hyper laser into my backpack when i touch it?

Asked by 10 years ago

I tried to do what the wiki said but it won't work..Here:

local assetId = 16688968
local instance = game:GetService("InsertService"):LoadAsset(assetId)
local plr = game.Players.PlayerAdded:connect(plr)
local backpack = plr:FindFirstChild("Backpack")
function onTouch()

    if instance then
game:GetService("InsertService"):Insert(instance)
instance.Parent = backpack
end
end

script.Parent.Touched:connect(onTouch)

1 answer

Log in to vote
0
Answered by
Thetacah 712 Moderation Voter
10 years ago

The most efficient way of doing this would be to clone the tool from ServerStorage Use:game:GetObjects("rbxassetid://asset id")[1].Parent = Workspace --To get the tool into the game

--Put the tool into ServerStorage
script.Parent.Touched:connect(function(hit)
    wait(1)
    if hit.Parent:FindFirstChild("Humanoid") and game.Players:GetPlayerFromCharacter(hit.Parent) then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        local character = hit.Parent
        local backpack = player:FindFirstChild("Backpack")
        if hit.Parent:FindFirstChild("Humanoid").Health >0  and backpack and not backpack:FindFirstChild("Tool") and not hit.Parent:FindFirstChild("Tool")  then
            local clone = game.ServerStorage.Tool:Clone()
            clone.Parent = backpack
        end
    end
end)







0
BUT if i do that then they are free models and not high quality like the ROBLOX versoins snoppyploptart 59 — 10y
0
What free models? It's a tool, m8 Thetacah 712 — 10y
Ad

Answer this question