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

How do I make a death event do this?

Asked by 10 years ago

I need a event happen when a person dies, and it teleports objects from a inventory gui to workspace, does anyone know how? If you need the script sample here it is :D :

`game.Players.LocalPlayer.Character.Humanoid.Died:connect(function(ondeathy)
if game.ReplicatedStorage:FindFirstChild(stuff[x].Value) then
local xxx = game.ReplicatedStorage:FindFirstChild(stuff[x].Value)
for i, v in ipairs(game.ReplicatedStorage:GetChildren()) do
    if v.Name == stuff[x].Value then
        v.Parent = Workspace
v:MoveTo(game.Players.LocalPlayer.Character.Torso.Position + Vector3.new(math.random(1,3),0,math.random(1,3)))
    end



end end end)`

the value x is 1, 16 and stuff is all of the slot values :D

4 answers

Log in to vote
1
Answered by
Azarth 3141 Moderation Voter Community Moderator
10 years ago

repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character local p = game.Players.LocalPlayer local c = p.Character local h = c:WaitForChild("Humanoid") local storage = game.ReplicatedStorage["Folder"] --folder with items local playerInventory = p.PlayerGui["Inventory"] --Wherever you're putting the player's inventory h.Died:connect(function() for i,v in pairs(playerInventory:GetChildren()) do local storageItem = storage:findFirstChild(v.Name) if storageItem then print("Dropped "..v.Name) clo = storageItem:Clone() clo.Handle.CFrame = c.Torso.CFrame + Vector3.new(math.random(-5,5),0,math.random(-5,5)) clo.Parent = Workspace end end end)
Ad
Log in to vote
1
Answered by 10 years ago

Output dead

Log in to vote
0
Answered by 10 years ago

Did you check the output?

0
It doesn't say anything deputychicken 226 — 10y
0
Please do not dedicate entire answers to this. Earn the ability to comment and reserve those to do these sorts of replies instead. Unclear 1776 — 10y
Log in to vote
0
Answered by 10 years ago

I am a bit confused on the question. Are you asking us to debug your code, or to right you a new one? Or to explain the code you gave?

0
I need someone to debug and explain deputychicken 226 — 10y
0
Well, then we will need the whole code. I can barely understand any of this, and if you don't want to release the whole code, then please PM me on ROBLOX AmericanStripes 610 — 10y
0
Alright :P deputychicken 226 — 10y
0
I sent it deputychicken 226 — 10y
View all comments (2 more)
0
Please do not dedicate entire answers to this. Earn the ability to comment and reserve those to do these sorts of replies instead. Unclear 1776 — 10y
0
I was stuck between two prediciments; A.) Post that, and be able to help or B.) Not help at all. I made the choice of A, but I understand, and hopefully next time I will at least attempt to somewhat give an answer. AmericanStripes 610 — 10y

Answer this question