I’ve created a script that check certain BoolValue, if it’s true, it runs the script. But once it does, the BoolValue just won’t update.
The local sript is:
local AnnouncementGui = game.StarterGui.AnnouncementTemplate
local AnnouncementValue = game.Workspace.Announcements.AnnouncementValue
repeat
wait(0.01)
if AnnouncementValue.Value == true then
AnnouncementValue.Value = false
local AnnouncementGUIClone = AnnouncementGui:Clone()
AnnouncementGUIClone.Parent = game.Players.LocalPlayer.PlayerGui
AnnouncementGUIClone.Frame.Position = UDim2.new(0.79, 0, 0.78, 0)
AnnouncementGUIClone.Frame.TextGoesHere.Text = "Text"
wait(10)
AnnouncementGUIClone:Destroy()
elseif AnnouncementValue.Value == false then
print("Standby")
end
until true == false
I don’t know how can I be more specific about the problem. If you feel like you know the solution, but you are unsure if you understood my problem correctly, please ask details in Replies. Whoever helps me, thank you in advance.
You are updating the BoolValue from the client. Therefore, it won’t replicate to the server. Use RemoteEvents to communicate between the Server and the Client to do these things.
The thing is, I have abosultely no idea how Remote Events work and how should I use them to achieve what I need to achive. Further help would be appreciated.
local BoolValue = true -- the boolvalue
local ReplicatedStorage = game:GetService("ReplicatedStorage") -- getting the replicated storage
local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent") -- defining the remotevent which we will be firing the server through
if BoolValue == true then -- checks if the boolvalue is true
-- run your code
RemoteEvent:FireServer(BoolValue) -- on this line, we're firing the server, and passing additional data which in this case is the BoolValue
end
(Server) Script:
local ReplicatedStorage = game:GetService("ReplicatedStorage") -- getting the replicated storage
local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent") -- defining the remotevent which we used to fire the server
RemoteEvent.OnServerEvent:Connect(function(player, BoolValue) -- Reacting to the remoteevent, you must NOT forget to define the player first, then the additional data, otherwise your script will break. player is the player that fired the server through the local script,
BoolValue.Value = false -- setting the BoolValue's value to false
end)
I hope this helps, and of course, do not forget, the devhub should always be your number one resource.
I’ve been trying to use your script, but here’s the thing: you added local BoolValue. But I need to update value existing in Workspace. So the script you’ve sent won’t help, or I don’t know how to use it.