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

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

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!

1 comment

0

_G on server and client are seperated that's why it returns nil

2 answers

✓ Accepted answer

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.

2 comments

0

Thanks! How would I go about fire to only one player/client instead of all of them?

0

remote:FireClient(the player you want fire)

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!

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