#item used to spawn trigger

1 messages · Page 1 of 1 (latest)

bleak ether
#

i need a script so that when an tool touches a invisible brick it destroys the tool and spawns in a model

#

sorry not string

#

lua

#

mb

wary tartan
#

do a .touched function, and if the "hit" is the tool, :Destroy() it

-- via a script inside of the brick

local part = game.workspace.Part -- the part the tool will touch
local model = game.ReplicatedStorage.Model -- your model

--[[

when the part is touched by anything this function below will run,
the "hit" is what is touching it,
rather it be a player or another part/object or tool, so on, it will run

]]--
part.Touched:Connect(function(hit)
    -- we should only allow this to continue if the "hit" is what we want, in this case, a tool
    if hit.Parent:IsA("Tool") and hit.Parent.Name == "MyToolsName" then
        local tool = hit.Parent
        -- if whatever triggered the funtion is a tool and has the name "MyToolsName", it will pass on to the next lines
        tool:Destroy()
        -- then move the model to the workspace, you could clone it if you plan to do this more than once
        model.Parent = game.Workspace
    end
end)

@bleak ether

#

i think i misread what you want to do, let me edit this

bleak ether
#

idk if i did it wrong or the script is off

#

e=part

#

collectible coin1 is model

#

and tool is SON

#

basically what i need it that you find a poster/tool and you take it to the part that destorys the tool and then it spawns in the coin/model

#

so ye

wary tartan
#

hella late reply but dont ignore the red lines in your code they usually will let you know if someone is wrong