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

Why do my remote events only sometimes get received?

Asked by 5 years ago
Edited 5 years ago

Hello, im developing a game and my remote events seem to only sometimes get received i have no idea why. Im presuming its down to lag. The local script ALWAYS fires, i know this because the print statement after the fire works however, the print statement after the function on the serverscript rarely happens. Anyway, here are my scripts that use the remoteevent:

--local script:

local frame = script.Parent:WaitForChild("Main")
local Event = game.ReplicatedStorage.Events:WaitForChild("PackPicking")

frame:TweenPosition(UDim2.new(0.5, -250,0.5, -250),'Out','Quint',1)

for i = 10,0,-1 do
    wait(1)
    script.Parent.TimeTillClose.Value = i
end

frame:TweenPosition(UDim2.new(0.5, -250,-1, -250),'Out','Quint',1)
Event:FireServer(script.Parent.Main.Choice.Value)
print(script.Parent.Main.Choice.Value)

--ServerScript:

local Event = game.ReplicatedStorage.Events:WaitForChild("PackPicking")

Event.OnServerEvent:Connect(function(plr,Pack)
    print(Pack)
    local Pack = game.ReplicatedStorage.npcCategories:FindFirstChild(Pack):FindFirstChild(plr.Team.Name)
    Pack:Clone().Parent = game.ReplicatedStorage.NPCTypes   
end)

If anyone sees or knows a solution to this super annoying problem please let me know. Thanks. P.S: As an alternative would a module script work?

Also @Incapaz, this is not a request :)

0
whats "script.Parent.Main.Choice.Value"? User#23365 30 — 5y
0
It is a string value containing the pack the user wishes to use. NoirPhoenix 148 — 5y
0
is there any another scripts using the RemoteEvent called "PackPicking" other than this script User#23365 30 — 5y
0
No just this one. But the UI this script is in calls that serverscript multiple times at the same time as other players see the same UI NoirPhoenix 148 — 5y
0
not sure if that affects anything NoirPhoenix 148 — 5y

Answer this question