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

Script gets stuck when firing a client remotefunction when player dies, why is this?

Asked by 3 years ago

So i am currently making a script which involves the server getting some information about the players mouse, it all works as intended until the player dies. When the player dies the script that fires the remotefunction that gives the mousedata, never gets the mousedata and just gets stuck. Does anybody know why this happens?

Here is the function in the main that needs the mousedata script:

01local rs = game:GetService("ReplicatedStorage")
02local remotes = rs:WaitForChild("Remotes")
03local telekinesisCooldown = 3
04local deBounces = {["abilityCooldown"] = false, ["toggleCooldown"] = false}
05 
06game:GetService("Players").PlayerAdded:Connect(function(plr)
07    local playerFolder = Instance.new("Folder", rs:WaitForChild("ActiveAbilities"))
08    playerFolder.Name = plr.Name
09 
10    local deBounceFolder = Instance.new("Folder", rs:WaitForChild("deBounce"))
11    deBounceFolder.Name = plr.Name
12 
13    for debounceName, value in pairs(deBounces) do
14        local deBounceBool = Instance.new("BoolValue", deBounceFolder)
15        deBounceBool.Name = debounceName
View all 55 lines...

And here is the localscript sending the mousedata:

1local player = game:GetService("Players").LocalPlayer
2local mouse = player:GetMouse()
3local giveData = player.PlayerGui:WaitForChild("givemouseData")
4 
5giveData.OnClientInvoke = function()
6    local mouseData = {mouse.hit.Position, mouse.Target, game:GetService("Players").LocalPlayer}
7    return mouseData
8end

Answer this question