Hi, I am trying to have te event communicate between a local and a server script, but it isn’t working or even printing anything. Here is my code:
Event fired
local player = game.Players.LocalPlayer
game.ReplicatedStorage.Events.PlayerTasks.OnClientEvent:Connect(function(task)
if task == "ResetDoor" then
script.Parent.Visible = true
while true do
local buttonsCompleted = {}
for i, v in pairs(script.Parent:GetChildren()) do
if v:IsA("TextButton") then
if v.Active == false then
table.insert(buttonsCompleted, v.Name)
end
end
end
wait(.01)
if #buttonsCompleted == 12 then
break
end
table.clear(buttonsCompleted)
end
script.Parent.FinalColor.BackgroundColor3 = Color3.fromRGB(0,255,0)
wait(2)
script.Parent.Visible = false
print("Firing")
game.ReplicatedStorage.Events.TaskCompleted:Fire("ResetDoor")
print("Fired")
end
end)
Server script:
game.ReplicatedStorage.Events.TaskCompleted.Event:Connect(function(TaskName)
print(TaskName)
if TaskName == "ResetDoor" then
script.Parent.Completed.Value = true
end
end)
Local script
game.ReplicatedStorage.Events.TaskCompleted.Event:Connect(function(TaskName)
print(TaskName)
if TaskName == "ResetDoor" then
script.Parent.Parent.Parent.Doors.ExitDoor.Generator.Display.Color = Color3.fromRGB(0, 255, 0)
end
end)