I had someone answer my last question on it, with a script, but their script doesn't work for some reason, I think it was because they put handle.Cframe, and there isnt a handle... anyway, i was wondering if someone could teach me about teleportation when a person dies, here is the script :D
01 | repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character |
02 | local p = game.Players.LocalPlayer |
03 | local c = p.Character |
04 | local h = c:WaitForChild( "Humanoid" ) |
05 | local storage = game.ReplicatedStorage [ "Folder" ] --folder with items |
06 | local playerInventory = p.PlayerGui [ "inventory" ] --Wherever you're putting the player's inventory |
07 | h.Died:connect( function () |
08 | for i,v in pairs (playerInventory:GetChildren()) do |
09 | if v:IsA( "StringValue" ) then |
10 | local storageItem = storage:findFirstChild(v.Value) |
11 | if storageItem then |
12 | print ( "Dropped " ..v.Value) |
13 | clo = storageItem:Clone() |
14 | clo:MoveTo(c.Torso.Positon + Vector 3. new(math.random(- 5 , 5 ), 0 ,math.random(- 5 , 5 ))) |
15 | clo.Parent = Workspace |
16 | end end end end ) |
Missing an end + misspelled Position
on line 16.
01 | repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character |
02 |
03 | local p = game.Players.LocalPlayer |
04 | local c = p.Character |
05 | local h = c:WaitForChild( "Humanoid" ) |
06 | local storage = game.ReplicatedStorage [ "Folder" ] --folder with items |
07 | local playerInventory = p.PlayerGui [ "inventory" ] --Wherever you're putting the player's inventory |
08 |
09 | h.Died:connect( function () |
10 | for i,v in pairs (playerInventory:GetChildren()) do |
11 | if v:IsA( "StringValue" ) then |
12 | local storageItem = storage:findFirstChild(v.Value) |
13 | if storageItem then |
14 | print ( "Dropped " ..v.Value) |
15 | clo = storageItem:Clone() |