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

How to use Remote Function?

Asked by 3 years ago

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)
0
You need to put the player in the first parameter of line 3 game.ReplicatedStorage.Speed:InvokeClient(player, speed) rabbi99 714 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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.

Ad

Answer this question