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

How would I go about changing a Value using Bindables, Remote Events, or Module Scripts?

Asked by 4 years ago

Im trying to make a Server Script say something like IntValue = 1 and then the Local script has an if IntValue == 1 then statement. I tried using _G Values but it just returns 'nill' in the local script. I would really love some help with this!

0
_G on server and client are seperated that's why it returns nil karlo_tr10 1233 — 4y

2 answers

Log in to vote
0
Answered by
karlo_tr10 1233 Moderation Voter
4 years ago
Edited 4 years ago

I will give you an example with remoteevents:

Insert RemoteEvent in replicated storage

Localscript:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage:WaitForChild("RemoteEvent")

local Value = 0

Remote.OnClientEvent:Connect(function(NewValue)
    Value = NewValue
end)

Script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage:WaitForChild("RemoteEvent")
wait(7)
Remote:FireAllClients(1)

In case you want to use intvalues you can just change value of them on the server and it will replicate to client as long as it's stored in place the client can access.

0
Thanks! How would I go about fire to only one player/client instead of all of them? finn383 2 — 4y
0
remote:FireClient(the player you want fire) royaltoe 5144 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

Here is an answer on how RemoteEvents work, here.

Wiki For RemoteEvents

Wiki For RemoteFunctions

Here is the ROBLOX Wiki for ModuleScripts

And a Developer Forum post on ModuleScripts and How They work, here.

Also, here is BindableEvents Wiki

And a BindableFunction Wiki


Hope this helps you with your research and how to use these to change values!

Answer this question