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

RemoteFunctions involving gui's not working?

I've never used Remote Function and this script isn't working script in SSS

game.Players.PlayerAdded:Connect(function()
	game:GetService("ReplicatedStorage").fui:InvokeClient()
end)

local script in startergui

local function gi()
	script.Parent.Text = "AAAAAAAAAAAAAA"
end
game:GetService("ReplicatedStorage").fui.OnClientInvoke = gi

this probably looks terrible

1 answer

✓ Accepted answer

###This is because you did not specify the client to invoke to. The first argument to RemoteFunction:InvokeClient() is the Player object for the server to invoke. Without it, how will the server know which client? You also should use RemoteEvents for those things, as RemoteFunctions are for two way communication and for returning things. You weren't returning anything.

game:GetService("Players").PlayerAdded:Connect(function(plr) -- passes player parameter
    game:GetService("ReplicatedStorage").fui:FireClient(plr) -- player to fire to
end)

###Client:

-- I have changed from a RemoteFunction to a RemoteEvent!

local function gi()
    script.Parent.Text = "AAAAAAAAAAAAAA"
end
game:GetService("ReplicatedStorage").fui.OnClientEvent:Connect(gi)

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