I have this inside a localscript inside StarterGui:
local player = script.Parent.Parent local char = player.Character char.Humanoid.Changed:connect(function(drop) if char.Humanoid.Health <= 0 then game.Workspace.drop:FireServer() end end)
and this in ServerScriptService as a serverside script
local event = Instance.new("RemoteEvent") -- creates the event object local p = game.ReplicatedStorage:WaitForChild("Bag") event.Parent = game.Workspace -- puts the event into the Workspace event.Name = "drop" -- giving a name to the event so we can fire it specifically elsewhere event.OnServerEvent:connect(function(player) -- define the function that will be called when the event is fired local c = p:Clone() c.Parent = game.Workspace c:MoveTo(player.Character.Torso.Position) end)
But this doesn't work as intended, any idea?