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

How to use Remote Function?

As far as I understand remote function needed in order to send information from script to local script and and make the requested action on the server. Okay, i watched a lot of videos and read a lot of explanations on the forums, but i still didnt understand how to use Remote Function. I have 1 script and 1 local script. I need players who have BoolValue = false to have Speed = 0 at a certain point. I could use RemoteEvent, but it easy to exploit, so thats why i want Remote Function. For example:

--Script
speed = 0
game.ReplicatedStorage.Speed:InvokeClient(speed)

--Local Script
local function teleportdetected(speed)
	if Value == false then
		game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = speed
	end
end

game.ReplicatedStorage.Speed.OnClientEvent:Connect(teleportdetected)

1 comment

0

You need to put the player in the first parameter of line 3 game.ReplicatedStorage.Speed:InvokeClient(player, speed)

1 answer

✓ Accepted answer

You got some of it right, but Remote functions don't use :Connect.

game.ReplicatedStorage.Speed.OnClientInvoke = teleportdetected

Oh, and in case you're confused, you don't need the player parameter unless you use :InvokeServer and .OnServerInvoke.

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