Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Remote function not running when invoked by cliant?

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

4 comments

0

do you ever call ur function?

0

and please take ur serverside script out of the character, put it in serverscriptservice

0

There’s multiple, 1 for each player infected. I can’t 

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

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.