so im making a game inspired by forsaken and DbD, but i need help on how to make the generators sync with the other players, to stop the generator from being completed again (i also dont know how to make a generator 'done' and not be able to be completed again (sorry i used chatGPT to help with most of this but im trying to stop using AI))
im very new to scripting, so youll probally see me in this forum again lol im trying to get out of scratch coding as its very limiting.
do i need to send the studio file? or the scripts? idk sorry
#forsaken/DbD fangame generator sync with other players
1 messages · Page 1 of 1 (latest)
You can use a boolean value to check if a generator has been finished
for example:
local Finished = false
local function Example()
if not Finished then
...
Finished = true
end
end
ok thanks
so would something like if Finished == true
[input generator code]
work
you need to check if Finished is false,
if Finished is false, then return.
Else, do nothing
local Finished = false
local function ExampleAgain()
if Finished == true then return end
-- your whole ass code here
end
something like this could work aswell
OR
would the boolean value be the same for everyone? so the same gen cant be dont multiple times?
local Finished = script.Parent.BooleanValueObject -- example of a path to a boolean value obj
local function ExampleAgain2()
if Finished then return end
-- you can also try
if Finished.Value == true then return end
end
Yup! if it's a server script
You need to use a RemoteEvent for this to work in this case, guessing its a GUI
yh its in a localscript lol
Then use a RemoteEvent
Kindof like this for example:
Local:
local RemoteEvent = pathtoyourremoteevent
RemoteEvent:FireServer(...) -- ... means arguements, like arg1, arg2, or true, false so on and so forth. you can basically transfer data or anything to the server. or just none
Server:
local RemoteEvent = pathtoyourremoteevent
RemoteEvent.OnServerEvent:Connect(function(...)
-- code here
end)
thanks
Also, just a reminder
It's okay to use AI to assist you in understanding and fixing, not make it do all of it.
If you need help on understanding something, your best bet is Google, Youtube, DevForums, and or ChatGPT (i reccomend a LuaU type bot)
If theres no answer on it, then you can go here.
ok thanks :]
** You are now Level 1! **
would numbervalues work aswell?
say, if one person got it to 40%
the generator would stay at 40% for everyone else
yuh!
Aslong as its transfered to the server, then its most defenitely okay