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

Drop on death remote event not working?

Asked by
Roytt 64
8 years ago

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?

0
Well, what's happening right now with the current script? XAXA 1569 — 8y
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 Roytt 64 — 8y

Answer this question