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?

2 comments

0

Well, what's happening right now with the current script?

0

It doesnt work, that's what happens. It only works in solo mode but it should also work in the online mode since i'm using remote events and the other remote events I have work just fine