方法
タッチしたら所持しているアイテムを全て消す例
script:
local Players = game:GetService("Players")
function onTouched(hit)
local player = Players:GetPlayerFromCharacter(hit.Parent)
if player == nil then return end
local Backpack = player:FindFirstChild("Backpack")
if Backpack ~= nil then
Backpack:ClearAllChildren() -- equiping not remove
for _,v in pairs(player.Character:GetChildren()) do
if v:IsA("Tool") then
v:Remove() -- equiping remove
end
end
end
end
script.Parent.Touched:connect(onTouched)
参考
https://developer.roblox.com/en-us/api-reference/class/Backpack
https://scriptinghelpers.org/questions/80608/how-do-you-remove-everything-in-a-players-backpack