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

Remote function not running when invoked by cliant?

Asked by 2 years ago
Edited 2 years ago

I have been trying for 3 hours now, the "Spread" function in the "ServerSide" script isnt running when invoking "InvokeServer()", out of all the prints in here the only thing printed to chat is this: "Temp debug: Invoking server"

No errors happen.

"Main" local script, trying to invoke the function that isnt working

local SpreadEvent = script:WaitForChild("Spread")

function Spread()
    print("Temp debug: Invoking server")
    local Target = SpreadEvent:InvokeServer() --made a oversight, now it does alot of stuff in a normal script so other clients receive it
    print("Temp debug: Server Responded")
    ****Removed rest of code since its not related****
end

"ServerSide" Script, This function is the one i want to run

local SpreadEvent = script.Parent:WaitForChild("Spread")

function Spread()
    print("Temp debug: Spread Assister Called (Server-side)")

    local PossibleAreas = FindFreeLocations()
    local Target = PossibleAreas[math.random(1,#PossibleAreas)] --Chooses random bodypart
    if #PossibleAreas == 0 then return end

    local NewResources = Resources:Clone()
    local Infector = Resources.Scripts.Infect:Clone()
    NewResources.Parent = Infector
    Infector.Parent = Target
    Infector.Disabled = false
    print("New bodypart (".. Target.Name.. ") Infected.")
    coroutine.wrap(HpChangeSymptom)()
    return Target
end

SpreadEvent.OnServerInvoke = Spread

These are only snippets of the scripts related to the issue

Explorer view of the scope the scripts use (Image, couldn't attach files): https://ibb.co/qBZhvHK

0
do you ever call ur function? Ak_aii 4 — 2y
0
and please take ur serverside script out of the character, put it in serverscriptservice Ak_aii 4 — 2y
0
There’s multiple, 1 for each player infected. I can’t  justinjosh5 19 — 2y
0
Think i found the issue, the serverside script isnt running at all, maybe since its parented to the local script? Im going to rework it and see if that works justinjosh5 19 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

After 2 days of debugging, the issue was caused by the scripts parent being the local script, i spent a day and reworked all the code so now its reversed

Ad

Answer this question