Loop cant fire event?

while wait() do
   if minutesVal.Value == 0 and secondsVal.Value == 0 then
       bought.Value = false
	   game.ReplicatedStorage.ShopEvents.ClaimedFolder.Claimed:FireServer()
       break
   end
end

I would also recommend adding a print("text") after the if statement to check if the event is not firing, or the values are not correct.

2 Likes

I have two scritps that checks if the timer is 0 one on the client and one on the server.

I will try that thx for sticking with me everyone.

in that case i’d reccomend merging the two scripts using a remotevent fired by the server to connect the two instead of a remoteEvent insecurely being fired from the client, possibly ruining the game by cheaters fireing the RemoteEvent.
removing this loop will also help upgrade the game’s performance.

1 Like

I would like to do that but my timer script dosent access the player and I need to change a player value :confused:

(for if there are clientsided objects, that do not exist from the server’s prespective)
Serversided

RemoteEvent:FireAllClients(Value)
--or
RemoteEvent:FireClient(Player,Value)

ClientSided:

RemoteEvent.OnClientEvent:Connect(function(Value)
---------whatever you want to change clientsided-----------
end)

If it is visible from the servers’s perspective, then you can change it from there, though this does imply that the server know’s what player to change. if you want it to change it on every client you can just make a for loop looping through all of the players and changing the value there.

local children = game.Players:GetChildren() 
for i = 1,#children do
children[i]-----------change the value here.------------
end

(edited the code a bit, sorry)

1 Like