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

I get an error when setting up this remote function. Any ideas?

Asked by 6 years ago

I get the following error when running these scripts: "cannot resume non-suspended coroutine"

its a remote function. the server script reads

local press = Instance.new("RemoteFunction")
press.Parent = script.Parent
press.Name = "FetchMousePressed"
script.Parent.Equipped:wait()
player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
local buttonpressed = function()
    return press:InvokeClient(player)
end

and the local script, which does the work, reads

local Mouse = game.Players.LocalPlayer:GetMouse()

script.Parent:WaitForChild("FetchMousePressed").OnClientInvoke = function()
    Mouse.Button1Down:connect(function()
    local Fire = true

    Mouse.Button1Up:connect(function()
        Fire = false
    end)

    return Fire
end)
end

any ideas?

0
I believe it is the fact you instantiated a local variable in a function. Notice the "local Fire." Think about what is happening with it. Hybric 271 — 6y
0
it should be being updated according to the user's mouse, if its being clicked or not. jiggiypuffs 30 — 6y

Answer this question