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

For looping a remotefunction creates a huge delay on server?

Asked by 3 years ago

Ok so i figured out why my script was creating a huge delay but i dont really know how i can fix it. Sooo the problem is that im for looping a remotefunction (from what im guessing). It creates a really big delay after a few moments. For example walking on client looks fine but on server looks delayed.

LocalScript:

local function getobjects()
    return game:GetDescendants()
end

for i,v in next, getobjects() do wait()
    v.Changed:Connect(function(p)
        game:GetService("ReplicatedStorage").Prop:InvokeServer(v, tostring(p), v[p])
    end)
end

ServerScript:

local PropRemote = game:GetService("ReplicatedStorage"):FindFirstChild("Prop") or false


PropRemote.OnServerInvoke = function(plr, part, prop, value)
    part[prop] = value
end

Is there anyway to run these codes without using a RemoteEvent/RemoteFunction?

0
From what I see here you don't know how a Remote Function works. You should return something back to the client. So what I see here is you need a RemoteEvent. MarkedTomato 810 — 3y
0
http://developer.roblox.com/en-us/articles/Remote-Functions-and-Events#client-to-server-1 If you still don't get how RemoteFunctions work there are a lot of Youtube tutorials explaining them. Since I've been coding I've never used a RemoteFunction so you'd rarely use them. MarkedTomato 810 — 3y
0
I do know how to use a Remote Function sir. What you're saying is completely different than what i asked. I get it that you are trying to help but if u do then atleast answer to my question. RemsFriend -24 — 3y
0
And also, you do not necessarily need to return something back to the client, or atleast in my case you dont. RemsFriend -24 — 3y

Answer this question