Currently working on something that is basically like Dead by Daylight’s Generator system.
So you interact with a part, loading bar progress shows, if you stop interacting with said part, the loading bar pauses.
This is part of the script I have atm:
rEvents.GenCountdown.OnClientEvent:Connect(function()
local TS = game:GetService("TweenService")
local gui = MainUI.Generator.Gen1Bar
local TI = TweenInfo.new(10,Enum.EasingStyle.Linear, Enum.EasingDirection.InOut,0,false,0)
local createAnim = TS:Create(gui, TI, {Size = Goal})
while true do
wait(0.2)
if (humanoid.Position - Gen2.Position).Magnitude < checkRange and eKeyDown() then
createAnim:Play()
else
createAnim:Pause()
end
end
end)
This is what I have at the moment, shows for client side (the progress) as in the progress resets for all players, wanting to make the tween progression be the same for all players. How would I go about making this happen? I understand firing the servers, fireallclients, etc. But where would I place that within that script? I’ve tried a lot of things and no luck at the moment.
Hmm… I would probably create an intValue into the part and change the value of it by script. When the value is changed u could catch that with local script and tween the progress bar. But idk if thats the most efficient way to do this
I would actually advise against that, as anything server sided can be exploitable.
I would approach this by containing a variable in a server script, this variable will contain the progress. For the client, you could have whatever minigame you have in store, and when they complete it, you could fire it back to that server script to increase the variable by however much, then fire that variable to all the clients (Using :FireAllClients() ) to update the progress bar for everyone in the server.
I don’t know if this helps any, but just an option!
You mentioned putting it inside a part, not server storage.
The variable would be inside the server script, which, when a client finishes their minigame, it would fire to the server script, activating the function. You could then return the function’s outcome of the variable thus changing the variable then you could send that variable To every client
Ok yes sorry for my part mistake, I ment ServerStorage, also now I see what u ment, but in this case every tycoon should have its own script, if u want to do this, its an option
Sounds like the best way to do this, I think I did something similar just without the interaction part, how would I go about constantly updating it for all clients? As in, not just updating it if it was to reach a specific part of the progression bar, basically just updating it constantly for all clients… A loop?
Well, a table can be a viable option for these types. If there is like more generators. It’s possible for someone to work on a generator, while someone works on another generator. This makes it so that the progress bars for the players with different gens buggy.
I suggest using a table to store players who are fixing the gen. Doing so will help a ton! Then, for every change that happened, use the in pairs function to fire the remote event/ remote function to every player that is working on a specific generator.